Send and receive messages via a Redis server
Project description
RedisBridge
RedisBridge is a Python package that handles sending and receiving messages across clients via a Redis server.
Installation
pip install RedisBridge
Requirements
- RedisBridge is intended to connect to a Redis server. To install and run Redis, see the instructions here.
- RedisBridge supports Python 3.6 or later.
Getting Started
- Spin up a Redis server
$ redis-server --port 6379 &
- Create a bridge on each client
>>> from RedisBridge import RedisBridge
>>> bridge = RedisBridge(host='localhost', port=6379)
- Register callbacks to receive messages
>>> def callback(msg):
... print('Received message:', msg)
>>> bridge.register_callback(callback, 'my_channel')
- Start each bridge to begin sending/receiving messages
>>> bridge.start()
- Send messages to other clients via bridge
>>> bridge.send('Hello World!', 'my_channel')
Each bridge calls all callbacks registered with it on the given channel
Received message: <Message: id='t2yedxi3', channel='my_channel', data='Hello World!'>
- Stop a bridge to close its connection to the server
>>> bridge.stop()
Docs
For much more detail about RedisBridge classes, messages, and usage patterns, check out the documentation. Seriously, go take a look.
Demos
For some toy examples and demos, check out the demos folder.
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
RedisBridge-2.0.4.tar.gz
(10.0 kB
view details)
Built Distribution
File details
Details for the file RedisBridge-2.0.4.tar.gz
.
File metadata
- Download URL: RedisBridge-2.0.4.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb01e6f952c0e6ad66ecf93ebd02b806f1386f95279bc7a5911393c7cb8572ac |
|
MD5 | 41a37ba8fda7c47c2f7084ffb1f51e66 |
|
BLAKE2b-256 | 21b2cece46dc01f86e84eb7883c025b881325ce5dcc00249d79e2f4200bd4cd3 |
File details
Details for the file RedisBridge-2.0.4-py3-none-any.whl
.
File metadata
- Download URL: RedisBridge-2.0.4-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdbc2ab2105f04e1c1d3ed3d56d9542c729bdb4d9b54a71b0ebcb4385c9327a3 |
|
MD5 | b8b8af5891bed2ce907c592f55ea78b5 |
|
BLAKE2b-256 | 2e84ad0344e7869704a61b380d5f04139ac6010f5f682d645021cb9b5a7150ce |