Reputation: 1706
I'm trying to find some "django-socketio" repo to use in my project. I using django 1.10 and python3. I really searched but I do not found working examples with python3.
My poor workaround
This work but I can't believe this is a good solution.. Anyone have other ideas? Or working examples with python3 and socketio?
Thanks!
Upvotes: 10
Views: 2522
Reputation: 2764
If you want to use Websockets and Django you should consider https://github.com/django/channels. The alternative in Python would be using python tornado http://www.tornadoweb.org/en/stable/ or aiohttp (Python3.4+) http://aiohttp.readthedocs.io/en/stable/. Many of the implementations of Django with asynchronousity through gevent are outdated, experimental or abandoned, I found this https://github.com/jrief/django-websocket-redis but it uses Redis so no reason to not going back to django-channels.
In my opinion, as Socket.io is a layer over Websockets you will not find any project that supports fully the Socket.io spec as a ws server in Python as it is a native Node.js not officially ported to Python project, at least the latest one you are probably using, if you really need Socket.io features stick to Node.js and create a simple REST API in Django to load the backend data asynchronously from Nodejs (the REST django API will always be synchronous by nature), this is the best shot you would likely have.
Upvotes: 8
Reputation: 614
https://github.com/django/channels/blob/master/docs/getting-started.rst
django-channels works with python3 and django >=1.8 :)
And you can change pip to pip3
Upvotes: 2