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
- I started node project and put socket.io inside route
- In my django view I send returning data to node route with my django session
- I manage session coming from django inside my node and emit inside route to client.
This work but I can't believe this is a good solution.. Anyone have other ideas? Or working examples with python3 and socketio?
Thanks!
1 Answers
Answers 1
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 in Python as it is a native Node.js not officially ported to Python project, at least the latest one you probably are 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 synchronously, this is the best shot you would likely have.
0 comments:
Post a Comment