简体   繁体   中英

Store SockJS connection on redis

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?

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

如果重新启动节点服务器,所有连接将丢失,并且客户端将断开连接,则无法存储连接以重新启动服务器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM