Question

When I connect and send some sockets to my Linux, node.js server inside a VPC and behind a load balancer I get a unusually long delay, followed by WebSocket connection to [address] failed: Connection closed before receiving a handshake response

And then a few seconds later I get responses for all the sockets I sent, and then everything works fine. No long delays.

But just on this initial connect, there's a horrible wait followed by this error message. Everything still works, it just takes a bit.

I'm using Amazon Web Service EC2 load-balancers and AWS VPCs

When I'm accessing the same server directly, I get no delays.

I was unable to connect to my server when having just a load-balancer. I was unable to connect to my server when having just a VPC, so I can't isolate the problem to just my load-balancer or the VPC.

What's going on?

The correct answer was Michael's comment that I marked as helpful. The first person who puts this into an answer format gets points.

Was it helpful?

Solution

The health of connection from the Load Balancer to the server is determined by the way in which your Health Check is set up.

Try and set it up differently.

eg

Use a TCP based Health Check rather than a HTTP based one, and change the thresholds.

If you see some different behaviour, you'll know that the Health Check is the issue.

OTHER TIPS

It is hard to know exactly without debugging, but note that there are issues on using Elastic Load Balancer for Web Sockets. They parse HTTP requests (unless in TCP mode) and they have a 60 seconds idle connection timeout.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top