I've tried deploying the example listed here:
https://github.com/miguelgrinberg/Flask-SocketIO/tree/master/example
To do this, I:
WSGIScriptAlias / /var/www/myframework/myframework.wsgimyframework.wsgi:
#!/usr/bin/python3
import sys
sys.path.insert(0,"/var/www/myframework")
from app import app as application
However, I get errors/warnings every second as the client attempts to reconnect repeatedly:
WebSocket connection to 'ws://saveclifford.com/socket.io/?EIO=3&transport=websocket&sid=ad8c6e5f81d54560936531a6aaca4989' failed: Error during WebSocket handshake: Unexpected response code: 400
http://saveclifford.com/socket.io/?EIO=3&transport=polling&t=1472326938478-16&sid=ad8c6e5f81d54560936531a6aaca4989 Failed to load resource: the server responded with a status of 400 (BAD REQUEST)
http://saveclifford.com/socket.io/?EIO=3&transport=polling&t=1472326939117-17&sid=ad8c6e5f81d54560936531a6aaca4989 Failed to load resource: the server responded with a status of 400 (BAD REQUEST)
http://saveclifford.com/socket.io/?EIO=3&transport=polling&t=1472326942478-27&sid=baa0fce2578a4136a580f04f6adae0b6 Failed to load resource: the server responded with a status of 400 (BAD REQUEST)
socket.io.min.js:2 WebSocket connection to 'ws://saveclifford.com/socket.io/?EIO=3&transport=websocket&sid=baa0fce2578a4136a580f04f6adae0b6' failed: WebSocket is closed before the connection is established.
http://saveclifford.com/socket.io/?EIO=3&transport=polling&t=1472326942664-29&sid=baa0fce2578a4136a580f04f6adae0b6 Failed to load resource: the server responded with a status of 400 (BAD REQUEST)
This all works fine on my localhost. Please point me in the right direction.
Apache/mod_wsgi is not a great web server to use for Socket.IO. You are basically restricted to using a single, multithreaded worker with long-polling. WebSocket does not work to my knowledge, and using multiple workers requires sticky sessions, which I believe mod_wsgi does not support.
You should be much better off using nginx. The documentation shows an example configuration. Also look at my flack application, which includes a working nginx config.
Most helpful comment
Apache/mod_wsgi is not a great web server to use for Socket.IO. You are basically restricted to using a single, multithreaded worker with long-polling. WebSocket does not work to my knowledge, and using multiple workers requires sticky sessions, which I believe mod_wsgi does not support.
You should be much better off using nginx. The documentation shows an example configuration. Also look at my flack application, which includes a working nginx config.