6

Deploying HTTP applications without downtime isn't that hard: HTTP is stateless, so with a load balancer in front of 2 HTTP applications solves the problem. If both applications use a common backend to handle the sessions, everything turns out fine.

However, WebSocket is a stateful protocol. Which means that if you shut down the application, the link will be cut.

Does WebSocket handle reconnecting seamlessly, in this case a load balancer handles the situation just like with HTTP applications? How is it possible to occur no downtime when deploying a WebSocket application?

  • websocket per se doesn't handle reconnection but most libs based upon websockets (notably socket.io) handle that. – Denys Séguret Feb 26 '14 at 09:23
  • @dystroy can they handle reconnecting on a different server? Or does it have to be on the same server? – Florian Margaine Feb 26 '14 at 09:23
  • The reconnection, which is initiated by the browser, should work fine. But usually socket.io isn't really stateless (see the `get` and `set` functions). You should ensure that the socket state is handled externally (it's easy to configure socket.io to use reddis). – Denys Séguret Feb 26 '14 at 09:25
  • Note also that if you store the state of the sockets in reddis and ensure the app downtime is short (a script might do the stop and restart in much less than a second), users might not notice at all any downtime. – Denys Séguret Feb 26 '14 at 09:45

0 Answers0