rohrpost is a simple WebSocket protocol that works well with Django using Channels. It will interface with every service implementing the ASGI specification (which, at the moment, is primarily Channels with Daphne).
The client implementation is rohrpost-js.
rohrpost specifies a very simple protocol with messages looking like this:
{
"id": 123,
"type": "ping",
"data": "something",
}
This message will be handled by the ping handler (which rohrpost provides out of the box). You can add custom handlers using a method decorator. Please see our documentation for details on the protocol and handler implementation.
rohrpost also provides a mixin for Django models to push notifications on changes (create, update, delete).
From the command line:
python -m pip install rohrpost
Or add this line to your requirements.txt:
rohrpost==3.*
For development you'll need to have the test environment installed. This is rather large since rohrpost works mainly in conjunction with Channels, Daphne, Django and so on.
python -m pip install -r requirements/dev.txt
Run tests and style checks in this directory:
python -m pytest python -m isort . python -m black rohrpost tests python -m flake8 python -m pylint --recursive=y --reports=y --verbose ./