Luis,
I think what Alex and Aymeric are saying is that "websockets" (I use
quotes to show that I mean not only the material outlined in RFC 6455
but also the general process of handling bytes-on-the-wire when
'pushing' data to the 'client') are ideally not part of the problem
that Django (and WSGI applications generally) are trying to solve.
Correct me if I'm wrong, gentlemen.
Alex and Aymeric gave really stellar talks on this topic, at PyCon.us
2010 and Djangocon.us 2013 respectively, and they're really worth
going back and watching. Of course Aymeric also maintains a websocket
library (
https://github.com/aaugustin/websockets).
At the end of the day, handling bytes-on-the-wire is really fun when
done on a different layer than your web MVC application. Colin
mentioned Hendrix - a Twisted container for Django. Instead of trying
to "do async" inside of WSIG, Hendrix (and some other WSGI containers)
allow you to run other python applications alongside your WSGI
application.
For example, I have a project called Cirque that uses Hendrix to both
serve a WSGI application (Django) and listen for mesh network traffic
on a UDP port. It reports mesh traffic to the Django application and
communicates directly with the websockets opened on the
Django-delivered resources.
This way, Django doesn't even need to realize that anything "async" is
happening.
It is also definitely worth paying attention to the web-sig mailing
list. As you can see, October has been mostly talk of what we want in
the next WSGI (
https://mail.python.org/pipermail/web-sig/2014-October/thread.html).
This post is starting to grow beyond the django-dev topic. If you
want to know more about the how's and why's, feel free to post in
django-users. As far as django development, there seems to be no
compelling argument, at least so far, to change Django's disposition
to make it "async."
>
https://groups.google.com/d/msgid/django-developers/CAFRnB2USMMbCp4r58J2zhf9HXpCAtiPYQ6UfgR%3D8Eiy%2BvC-d9w%40mail.gmail.com.
Peace and Persistence
jMyles