For me information, see the full article.
-
Create a virtualenv and download the project.
-
Install the requirements:
$ pip install -r requirements.txt
$ gunicorn_django -c config/gunicorn
- Open your browser at
http://localhost:8000/
. - Open the javascript console.
- Open a python interpreter (within your virtualenv).
To send a Server-Sent Event:
>>> from django_sse.redisqueue import send_event
>>> send_event('myevent', 'text')
To send a SocketIO packet from the server to the browser:
>>> from myapp.utils import emit_to_channel
>>> emit_to_channel('default_room', 'myevent', 'text')
To send a SocketIO packet from the browser to the server:
> socket.emit('myevent', 'default_room', 'text')
Released under the MIT License.