Hello,
I’m wondering if it’s possible to make a module for proxying websockets
for nginx.
I read Emiller’s Guide to Nginx Module Development – Evan Miller …
From what I understand nginx normally works like this:
- keep connection with client
- connect to proxy and make request
- do something else
- get response from proxy and reply to client
Now, a websocket connection will drop when it issues the upgrade command
to nginx. A couple of questions
- Does nginx need a persistent connection per client with the proxy to
do websocket proxying? - For proper websocket proxying would the proxy rather have to be a
gateway or tunneling proxy in nature? - If 2 holds, does that even fit into the nginx architecture?
I know there is handshake issues with draft 76, but assuming I ignore
them, is it possible to implement a websocket proxy to nginx?
If so, can anyone give me some hints on how to do that? If not what
would be the alternative? If I were to build a websocket module
for nginx, that does all the handshaking inside nginx, how would the
backend notify nginx that there’s new data available?
Regards,
Reza
Posted at Nginx Forum: