2

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?

bdem
  • 121
  • 3

1 Answers1

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.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • According to this http://serverfault.com/questions/595047/option-http-server-close-on-haproxy-haproxy-1-5-dev19-will-result-in-connection 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 05 '14 at 06:13