0

I'm new to HAProxy so this might have an obvious answer but I wasn't able to find it.

Consider this setup:

  • two backend web applications;
  • one HAProxy in front of the web applications;
  • many clients with websocket capable browsers;

A client opens a websocket connection to the HAProxy which chooses a web aplication by round robin, let's say WebApp1 is chosen. The websocket connection stays on WebApp1 and is tunneled through the HAProxy.

If WebApp1 goes down, the client receives a disconnect, reconnects again, goes through the HAProxy which now selects WebApp2 and the websocket connection stays on WebApp2 tunneled through HAProxy.

That's the normal setup, right?

What I want to ask if it's possible for HAProxy to keep the websocket opened with the client and when WebApp1 goes down transparently move that end of the connection to WebApp2 without the client knowing about it. Is this possible?

0

No, that's not possible, because the new server knows nothing about the state of the previous connection. A WebSocket is not stateless like UDP or ØMQ. The client must reconnect in this case.

| improve this answer | |
  • According to this serverfault.com/questions/595047/… it seems that HAProxy can keep the connection open for the client but chose different backend servers to serve the requests. At least for TCP. Is it not the case for websockets also? They are a thin protocol on top of TCP. – bdem Aug 5 '14 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.