Skip to content
Websockets for Django with Centrifugo
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Mention the Darwin support for the installer in doc Feb 16, 2019
instant Version 0.6.11 Feb 16, 2019
.coveragerc Update config files for tests Jun 22, 2018
.gitignore Update config files for tests Jun 22, 2018
.travis.yml Update config files for tests Jun 22, 2018
LICENSE Initial commit Aug 1, 2016
requirements.txt Add django-cors-headers to requirements.txt Sep 22, 2018
setup.cfg Setup Sep 12, 2016 Add django-cors-headers for Django 2 Sep 22, 2018

Django Instant

Build Status Coverage Status

Websockets for Django with Centrifugo.

  • Push events into public or private channels.

  • Handle the events in javascript client-side.

☀️ Compatible: plug it on an existing Django instance without any modification in your main stack.

Straightforward: no particular concepts to know, no learning curve: just push events and handle them client-side.

Check the documentation for the install instructions.

Quick example

Push events in channels from anywhere in the code:

from instant.producers import publish

# Publish to a public channel
publish(message="Message for everyone", channel="mysite_public")

# Publish to a private channel with an event class set
publish(message="Message in private channel", channel="$private_chan", 

# Publish to the staff channel with an extra json data payload
data = {"field1":"value1","field2":[1,2]}
publish(message="Message for staff", channel="$mysite_staff", data=data)

Handle the events client-side in a template:

if (event_class === 'test') {
      console.log("This is a test message: " + message);

Using this

Django Presence: user presence notification widget

Django Mqueue Livefeed: multi-sites realtime application events and logs

Django Autoreloader: watches files change and autoreload in browser

Django Term: in browser terminal for Django

Django Rechat: basic chat app (toy app for now)


Most of the websockets solutions associated with Django today require some modification in the main stack, like uwsgi, and often come with a whole bunch of new concepts to figure out, making the newcomer to feel like he is walking in the dark.

We wanted a solution that could plug on a safe classic Django stack without having to do any tweaks on it. The Centrifugo websockets server handles the job very well, better than all the python solutions I know IMHO. This made it possible to build an app that just plugs on an existing Django stack. The API is simple and does not involve any new concept.

We are trying to ship a fully compatible, easy to install and ready to use websockets solution for Django: websockets in Django should not be a big deal.

You can’t perform that action at this time.