WebSocket SDK for Centrifugo (and any Centrifuge-based server) on top of Python asyncio library
Project description
centrifuge-python (work in progress)
This is a WebSocket real-time SDK for Centrifugo server (and any Centrifuge-based server) on top of Python asyncio library.
[!TIP] If you are looking for Centrifugo server API client – check out pycent instead.
Before starting to work with this library check out Centrifugo client SDK API specification as it contains common information about Centrifugal real-time SDK behavior.
The features implemented by this SDK can be found in SDK feature matrix.
Install
pip install centrifuge-python
Then in your code:
from centrifuge import Client
See example code and how to run it locally.
Run tests
To run tests first start Centrifugo server:
docker run -p 8000:8000 centrifugo/centrifugo:v5 centrifugo --client_insecure --log_level debug
And then:
python -m venv env
. env/bin/activate
make dev
python -m unittest discover -s tests
Run example
Start Centrifugo with config like this (defines namespace called "example", enables features used in the example):
{
"token_hmac_secret_key": "secret",
"namespaces": [
{
"name": "example",
"presence": true,
"history_size": 300,
"history_ttl": "300s",
"join_leave": true,
"force_push_join_leave": true,
"allow_publish_for_subscriber": true,
"allow_presence_for_subscriber": true,
"allow_history_for_subscriber": true
}
]
}
And then:
python -m venv env
. env/bin/activate
make dev
python example.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for centrifuge_python-0.3.0b1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e61bc31ddd02fa6915e8ac8c07e7070bbbbaeceac1743b160d3682071dadb40 |
|
MD5 | cc1fe884a78c279f29e7b25d1011f89f |
|
BLAKE2b-256 | 9c5acfac5f8d35cd57ebfa4d2012221690501ab23f7709272751c4d9cf5fbe63 |
Hashes for centrifuge_python-0.3.0b1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bc5ca4a8a0d2093543572fe36cb1f42b6af12ba77504d1fb5b928dca0f501a2 |
|
MD5 | 0b0207507338aeb89b30ce5ec2205d27 |
|
BLAKE2b-256 | 47ea21448b286882e774c8e73fbf18e2f8cbcc8cc6f4f13bd177216438c3b783 |