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.

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

Uploaded Source

Built Distribution

socker-1.2-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for socker-1.2.tar.gz
Algorithm Hash digest
SHA256 5891632e31297fe97a5fe22910117eb745c8d8f334304537c6cd9535669c8c5b
MD5 41ae9092aaa88d75b9bbb50ea5c04d2d
BLAKE2b-256 1e63713f566532549196877438a209663a45a921269deb3c1e2d877b7b6c2e97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for socker-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 64affce9d083e8cb3df2231bf154c118934cb550e75f6ee9dde28126540b7b99
MD5 3ad4a36a65779d6953cf910c6df305fa
BLAKE2b-256 3a710d03082f318af0f50ee74879a307771b16b0d4640ca19620a9ac0129f354

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