Skip to main content

Django package for via nodejs

Project description

### What is django-socketio-events?

Simply adds functionality to Django applications by proxying Django behind a Nodejs/SocketIO server.

Any callback function defined in an `app_folder` is exposed to Socket.IO as the target `my_app.callback_fn`. See examples below.

### Usage

python runserverjs <hostname> <public port> <proxy port> <socket port>

In any Django template that you want a Socket IO connection, add this templatetag to your HEAD:

{% load nodjango %}
<!doctype html>
<script type="text/javascript" src="//"></script>
{% socketio_head_scripts %}
<button>Click Me</button>
<script type="text/javascript">
socket.on('my_callback', function(data){

$('button').on('click', function(){
socket.emit('django', {
'event': 'my_app.change_color',
'callback': 'my_callback',
'color': 'red'

# my_app/

def change_color(color):
# change color
# ...
# profit
return {'result': 42}

### Installation

pip install django-socketio-events

And then add `nodjango` to your `INSTALLED_APPS`.

### Under the hood

* [virtual-node]( for installing [node.js]( in a Python virtualenv.
* [Django]( web framework

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-socketio-events, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size django-socketio-events-0.1.2.tar.gz (30.4 MB) File type Source Python version None Upload date Hashes View

Supported by

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