Skip to main content

rohrpost WebSocket protocol for ASGI

Project description

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.

Capabilities

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).

Installation

From the command line:

pip install rohrpost

Or add this line to your requirements.txt:

rohrpost==3.*

Development

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.

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 ./

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page