Skip to content

Simple WebSocket protocol for Django (with Daphne)

License

Notifications You must be signed in to change notification settings

axsemantics/rohrpost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c9fbf6b · Oct 18, 2024
Oct 18, 2024
Aug 14, 2024
Aug 14, 2024
Aug 14, 2024
Jul 16, 2021
Jul 16, 2021
Mar 12, 2021
Aug 14, 2024
Mar 11, 2021
Aug 16, 2023
Aug 14, 2024
Aug 29, 2018
Aug 16, 2023
Aug 14, 2024
Mar 12, 2021

Repository files navigation

rohrpost ghactions coveralls pypi

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:

python -m 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.

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