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 SDK for Centrifugo server (and any Centrifuge-based server) on top of Python asyncio library.
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
pip install -r requirements.txt
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
pip install -r requirements.txt
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.0b0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60a93ea6a068a5cd5b0926e0632adafd5e009df775bd7409c3c2940483904894 |
|
MD5 | 0d4d2fbbae735bc1e9ad17c58a42086a |
|
BLAKE2b-256 | 74a65662d23c0fa00e80bb3128091439133e21f6c93c94181d3f9627f86be98a |
Hashes for centrifuge_python-0.3.0b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b2ec34702908c5e68de2e22ccd1cff977dd239c198b25dee5369425b457586e |
|
MD5 | b4c200625fc5b78e0c0865a4902237a0 |
|
BLAKE2b-256 | 8fff200fc331f2447cc274f1012bb04f6f1fe9ccdc18c7e1a0d34514584a2b10 |