Currently, it is difficult to work with most reverse proxies (nginx, HAproxy) when working with web sockets. I thought it was possible to do something like this:
io.connect("http://yourdomain:8080/chat");
So, an example workflow:
- nginx listens on port 80
- nodejs is listening on port 8080
- socket.io listens on port 8080 through nodejs application
- nginx proxies any requests on port 80 to nodejs on 8080
- The socket.io client connects directly to the node / socket server on port 8080 and communicates directly without a reverse proxy.
I can’t make it work - isn’t that possible, or am I doing something wrong?
EDIT: This really works, my problem was sending _id MongoDB _id .
I wrote a more detailed description here
source share