0

I need to offload connections from the node server to redis, so I could update (and restart) the node server on a live system. Then pull the connections back from redis into node. Is this possible with SockJS connections?

Rob Fox
  • 5,355
  • 7
  • 37
  • 63

2 Answers2

1

I have a suggestion (don't know if it still on time):

There is no way you can store networking connection on wherever (it not serializable in any way, since it is based on OS resources). But you can store on Redis (or any other storage mechanism) all relevant user session state, indexed by an user id of any kind.

In order to recover from a server reboot (or crash), the client could reconnect and given that it knows the user id, it can be reattached to the session state.

If you have any kind of fail over mechanism, or if the reboot process is short enough, your users will feel nothing but a little freezing on communication, if any.

I hope this can help.

Regards.

Heleno

helenov
  • 341
  • 1
  • 2
  • 15
0

If you restart your node server all your connections will be lost and your clients will be disconnected, there is no way to store the connections to reboot a server.

Emanuel Ralha
  • 754
  • 4
  • 12
  • If the server restart-cycle completes before the next heartbeat arrive, previously connected clients will reconnect to same server. I think its ***possible***. – dklt Dec 06 '13 at 02:11
  • but the session state will be gone for all the connections i think, correct me if im wrong. – Emanuel Ralha Dec 13 '13 at 18:12
  • reconnecting to the same server would be unlikely to happen since nowadays all web applications runs multiple instances. so something else has to be done. – kroe Jun 24 '15 at 18:53