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

socker is not on PyPI, so you’ll have to run

pip install -e 'git+http://github.com/5monkeys/socker.git#egg=socker'

in order to use it.

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.

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

Uploaded Source

Built Distribution

socker-1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for socker-1.0.tar.gz
Algorithm Hash digest
SHA256 e1c86c25eb2f452d88a65dc0c44ea5dc3509833f8287b8b877c65314bd8d20ba
MD5 13e0a45e96ddef12fb05f3c5f26b2600
BLAKE2b-256 bae6dbf9d3baa7f95439547dab74b3cb1df07472eb781ce916ed52cbc3f9ebba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for socker-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 612ba7c0ea7d87c1ee22a2a9fd786ca00075d4b24054105a3b99610fa50bdced
MD5 3ca4fa87f3da9e384dabacecf1990fa3
BLAKE2b-256 6889702cba6be05152b58301992f2f72a4799312038fd0f7d8aa092f0b789d51

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