Skip to main content

Websocket support for Django using Redis as datastore

Project description

Project home: https://github.com/jrief/django-websocket-redis

Detailed documentation on [ReadTheDocs](http://django-websocket-redis.readthedocs.org/en/latest/).

Online demo: http://django-websocket-redis.awesto.com/

Websockets for Django using Redis as message queue

This module implements websockets on top of Django without requiring any additional framework. For messaging it uses the [Redis](http://redis.io/) datastore and in a production environment, it is intended to work under [uWSGI](http://projects.unbit.it/uwsgi/) and behind [NGiNX](http://nginx.com/) or [Apache](http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html) version 2.4.5 or later.

Features

  • Largely scalable for Django applications with many hundreds of open websocket connections.

  • Runs a separate Django main loop in a cooperative concurrency model using [gevent](http://www.gevent.org/), thus only one thread/process is required to control all open websockets simultaneously.

  • Full control over this separate main loop during development, so Django can be started as usual with ./manage.py runserver.

  • No dependency to any other asynchronous event driven framework, such as Tornado, Twisted or Socket.io/Node.js.

  • Normal Django requests communicate with this separate main loop through Redis which, by the way is a good replacement for memcached.

  • Optionally persisting messages, allowing server reboots and client reconnections.

If unsure, if this proposed architecture is the correct approach on how to integrate Websockets with Django, then please read Roberto De Ioris (BDFL of uWSGI) article about [Offloading Websockets and Server-Sent Events AKA “Combine them with Django safely”](http://uwsgi-docs.readthedocs.org/en/latest/articles/OffloadingWebsocketsAndSSE.html).

Please also consider, that whichever alternative technology you use, you always need a message queue, so that the Django application can “talk” to the browser. This is because the only link between the browser and the server is through the Websocket and thus, by definition a long living connection. For scalability reasons you can’t start a Django server thread for each of these connections.

Release History

Refer to [changelog.rst](docs/changelog.rst)

Build status

[![Build Status](https://travis-ci.org/jrief/django-websocket-redis.png?branch=master)](https://travis-ci.org/jrief/django-websocket-redis) [![Downloads](http://img.shields.io/pypi/dm/django-websocket-redis.svg?style=flat-square)](https://pypi.python.org/pypi/django-websocket-redis/)

Questions

Please use the issue tracker to ask questions.

License

Copyright © 2015 Jacob Rief.

MIT licensed.

Project details


Download files

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

Source Distribution

django-websocket-redis-plus-0.6.0.1.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_websocket_redis_plus-0.6.0.1-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file django-websocket-redis-plus-0.6.0.1.tar.gz.

File metadata

  • Download URL: django-websocket-redis-plus-0.6.0.1.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for django-websocket-redis-plus-0.6.0.1.tar.gz
Algorithm Hash digest
SHA256 87287698dc388ff6b91f60335fb70bb8d645c82936d732c47dcf6941652d88a2
MD5 999945eea06167b7abc62e93d6740258
BLAKE2b-256 ec48220b9ac9042cd269248cd70cfe0b2b1cab4da54981e24d092b60f96ab712

See more details on using hashes here.

File details

Details for the file django_websocket_redis_plus-0.6.0.1-py3-none-any.whl.

File metadata

  • Download URL: django_websocket_redis_plus-0.6.0.1-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for django_websocket_redis_plus-0.6.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b3b18ba45db4b5c9af069f72931b9fc0eaf1f5e328e724194921a9cf7095ae8
MD5 a40f5656805710948b9d59a6ddced7a1
BLAKE2b-256 c404d5220c5aa9679073e33b5c4b03287321839c3de3649840cf7cf8f3ea903c

See more details on using hashes here.

Supported by

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