Websockettien käyttö
Kerätään tähän korttiin keskustelua Websocketeista ja niihin liittyvistä ongelmista.
Gunicornin (lievä) yhteensopimattomuus
Sivulla https://flask-socketio.readthedocs.io/en/latest/ sanotaan seuraavaa:
Gunicorn release 18.0 is the recommended release to use with Flask-SocketIO. The 19.x releases are known to have incompatibilities in certain deployment scenarios that include WebSocket.
ja
There are two requirements to use multiple Flask-SocketIO workers:
The load balancer must be configured to forward all HTTP requests from a given client always to the same worker. This is sometimes referenced as “sticky sessions”. For nginx, use the ip_hash directive to achieve this. Gunicorn cannot be used with multiple workers because its load balancer algorithm does not support sticky sessions.
Toisin sanoen websocketteja käytettäessä workereita pitää Gunicornissa olla yksi.
Jos 1 worker ei osoittaudu ongelmaksi (eventlet-workeria käytettäessä), niin ok. Tosin silloinkin kannattaisi ilmeisesti ohjeen mukaan downgradeta Gunicorn vanhempaan (18.0) versioon. Muuten pitää valita jokin toinen deployment-konffi Flaskille: https://flask-socketio.readthedocs.io/en/latest/#deployment
Apache ja websocketit
VL:
Sitten en tiedä miten sen timgamman apache suhtautuu websockettiin koska sanotaan ettei apache kykene massiiviseen määrään yhteyksiä.
ML: Apache ainakin näyttäisi tukevan websocketteja: https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html