We have a web application setup with Barracuda Load Balancer (3 servers running). We want to implement node js using websocket (socket.io) but its always falling into xhr-polling (which is way too slow) if the request comes through the load balancer.
The following are what we tried to fix this:
what puzzling us is that if we only use one server and does not go to load balancer, it will went OK but if we are going through load balancer, it cannot connect via websocket and always falls back to xhr-polling.
this is what nginx error-log is getting:
*14369 connect() failed (111: Connection refused) while connecting to upstream, client: 121.96.XX.XXX, server: www.example.co.uk, request: "GET /socket.io/ HTTP/1.1", upstream: "http://192.168.XX.XXX:3000/socket.io/", host: "www.example.co.uk"