Skip to main content

redis pubsub websocket proxy

Project description

socker runs as a single-process service, using asyncio for non-blocking I/O.

socker uses a single redis pubsub channel, and has its own channel subscription logic, this means that you may share redis database with other applications.

socker runs as a single-process service. socker opens up a websocket server port and establishes a redis connection. The redis connection creates a subscription on the socker channel.

Installation

pip install socker

Usage

$ socker -h
Start the socker websocket server

Usage:
  socker [options]
  socker -? | --help
  socker --version

Options:
  -i INTERFACE    Listening interface [default: localhost]
  -p PORT         Listening port [default: 8765]

  -v              Enable verbose output

  --redis-host=HOST             Redis host [default: localhost]
  --redis-port=PORT             Redis port [default: 6379]
  --redis-db=DB                 Redis database [default: 0]
  --redis-password=PASSWORD     Redis password

  --logto FILE    Log output to FILE instead of console

  --version       show version
  -? --help       Show this screen

To publish a message to socker from another application:

from socker import Message


channel = 'foo.bar.42'
data = {
    'yes': [
        'yes',
        'no',
        'baz'
    ]
}

redis_client.publish('socker', Message(channel, data))

Any websocket clients subscribed to

  • foo.*

  • foo.bar.*

  • foo.bar.42

will receive that message.

Releasing a new version to PyPi

  1. Bump the version in VERSION.

  2. Commit the change and tag it with the new version identifier.

  3. Build a source distribution: python setup.py sdist.

  4. Build a wheel: python setup.py bdist_wheel.

  5. Upload the built distribution using Twine: twine upload dist/*.

Thanks

Thanks to

for their brilliant asyncio packages.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

socker-2.0.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

socker-2.0.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file socker-2.0.1.tar.gz.

File metadata

  • Download URL: socker-2.0.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for socker-2.0.1.tar.gz
Algorithm Hash digest
SHA256 a904c8d87dcbba9e93580de0b3b1731d6143b725e2e7eb00d0795cf4c5f5ffba
MD5 64ed2437b55b1a09cc604750175d9410
BLAKE2b-256 a05964eb0be8c03b457ea744b05fa8cea988670214be7c9541abd203a3bee503

See more details on using hashes here.

File details

Details for the file socker-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for socker-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d04836f1bcd79c5c62f1b7cd54b4c3c6e1e91b931bb89baadf0672f4cd402437
MD5 f2293ce7abed1ed0f8f777aa59ec07e1
BLAKE2b-256 04df9d25e84f2cef2e061453b2bba186478c7619b6afcd012ddad0379f54569e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page