OK I *think* the docs are incorrect -- they currently say that nginx just works out of the box, but as far as I can tell that's incorrect, you need to explicitly get it to proxy the Upgrade and Connection headers:

https://nginx.org/en/docs/http/websocket.html


here's a PR to fix the docs (if indeed I am correct! it's still not working. https://github.com/unbit/uwsgi-docs/pull/362)


rgds,
Harry & the PythonAnywhere team




On 07/07/17 11:49, Harry Percival wrote:
Hey there uwsgi friends,


Thought I'd do a little experiment to see if we can get websockets working in our infrastructure. here's the setup:


* loadbalancer: nginx forwards http requests to correct web server based on domain name

* web server: nginx listens on port 80, proxies to uwsgi via "uwsgi_pass" to a unix socket

* uwsgi emperor

* uwsgi vassals: listen on correct socket


all works fine for standard WSGI HTTP/S stuff. now I'd like to see if websockets will work.


It's a bit hard to tell from the documentation whether things should "just work" already, or whether I need to set up additional routing in nginx? https://uwsgi-docs.readthedocs.io/en/latest/WebSockets.html


currently I'm seeing uwsgi.websocket_handshake() seems to work ok, but uwsgi.websocket_recv() is hanging/failing with an OSError: unable to receive websocket message

uwsgi --version 2.0.14

nginx version: openresty/1.9.15.1



cheers all!

Harry.



_______________________________________________
uWSGI mailing list
uWSGI@lists.unbit.it
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

--
Harry Percival
Developer
ha...@pythonanywhere.com

PythonAnywhere - a fully browser-based Python development and hosting 
environment
<http://www.pythonanywhere.com/>

PythonAnywhere LLP
17a Clerkenwell Road, London EC1M 5RD, UK
VAT No.: GB 893 5643 79
Registered in England and Wales as company number OC378414.
Registered address: 28 Ely Place, 3rd Floor, London EC1N 6TD, UK

_______________________________________________
uWSGI mailing list
uWSGI@lists.unbit.it
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to