I'm trying to set up a Django server with Socket.io running. I've looked all over the place and tried a million different things but I can't figure out how to get nginx and gunicorn to play nice with django-socketio. Can anyone help? Specifically, is there a tutorial anyone can point me to that they have successfully gotten to work? Thanks!
Asked
Active
Viewed 1,122 times
0
-
Better idea: Use django channels: http://channels.readthedocs.org/en/latest/ – user14717 Dec 14 '15 at 22:00
-
I'm not sure that will do what I want. I don't see any way to send messages back from the client? Is there a javascript library that accompanies this? – TheGratefulShaman Dec 14 '15 at 22:11
-
@NickThompson django-channels is in alpha at best, it's not ready for production, It should be merged into Django in 1.10. – knbk Dec 14 '15 at 22:12
1 Answers
0
The trick is to have a nginx block that catches socket.io frames and forwards them to your the django-socketio server. Assuming thats running on port 9000, try:
location /socket.io/ {
proxy_pass http://127.0.0.1:9000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
}
A good tutorial can also be found here .

Isaac Ray
- 1,351
- 9
- 17