Skip to main content

django-mease: Websocket integration made easy for Django

Project description

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



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

  # List of your installed apps


Start websocket server

python run_websocket_server

Register callbacks

Create files to register your callbacks (the file must be located in an installed app):

from djmease import mease

def open_websocket(client, clients_list):["name"] = "mymane"
    for c in clients_list:
        c.send("Someone joined")

def close_websocket(client, clients_list):
    for c in clients_list:
        c.send("{name} left".format(["name"]))

def receive_websocket_message(client, clients_list, message):
    for c in clients_list:

def send_websocket_message(channel, clients_list, myobj):
    for c in clients_list:


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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-mease, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size django-mease-0.2.0.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page