django-mease
Work in progress.
Websocket integration made easy for Django using Tornado, Redis PUB/SUB and easy to use callback registry mechanism.
See a full working example here
RTD INCOMING SHORTLY
Installation
Dependencies (Debian & Ubuntu)
Mease comes with Redis PUB/SUB backend by default. If you want to use it, install these dependencies :
sudo apt-get install redis-server python-dev pip install redis
Install django-mease
pip install django-mease
Add mease to your INSTALLED_APPS
INSTALLED_APPS = (
# List of your installed apps
'djmease',
)
Usage
Start websocket server
python manage.py run_websocket_server
Register callbacks
Create mease_registry.py files to register your callbacks (the file must be located in an installed app):
from djmease import mease
@mease.opener
def open_websocket(client, clients_list):
client.storage["name"] = "mymane"
for c in clients_list:
c.send("Someone joined")
@mease.closer
def close_websocket(client, clients_list):
for c in clients_list:
c.send("{name} left".format(name=client.storage["name"]))
@mease.receiver
def receive_websocket_message(client, clients_list, message):
for c in clients_list:
c.send(message)
@mease.sender(routing=['websocket'])
def send_websocket_message(channel, clients_list, myobj):
for c in clients_list:
c.send(myobj.myattr)
Publish
Use mease.publish to publish from anywhere in your code :
from djmease import mease
mease.publish('websocket', "Hello world !")
This will call all sender functions registered on the ‘websocket’ routing.
Metadata
Release files for django-mease 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-mease-0.2.0.tar.gz | 3.9 kB | Without provenance | Details for django-mease-0.2.0.tar.gz |
Release files / django-mease-0.2.0.tar.gz
| Download URL | django-mease-0.2.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a0f133164ea0ea6a04099dee36952cf9b22b6bb9e833f887b1077acbdffdd86
|
|
BLAKE2b-256 checksum How to use checksums |
df676c11e3b07d0732a20cd11120484bbf5272c86e7dd77346201edb832f53be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-mease 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.