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.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

socker-2.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: socker-2.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for socker-2.1.0.tar.gz
Algorithm Hash digest
SHA256 16e8a905e6c1bd016195a34dc0c9aa0fce5b774edbb246d5f2a05a4172a17053
MD5 bf30dbb814e6f7d2ca1b6d246a71b07b
BLAKE2b-256 afda85c55598100753693805bac2ead5644b112b7a5b07e361cc71afbead0814

See more details on using hashes here.

File details

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

File metadata

  • Download URL: socker-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for socker-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 185810ccef924890bfa9ee8c24a88fc19e5751b4c27ddf3746e2e1e62830954c
MD5 ea2faa4ea652b8ade4f69652215eba45
BLAKE2b-256 070eb6833beea974485099d9ff645e52d425ed080eb6a512f248d001be058c88

See more details on using hashes here.

Supported by

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