Examples in using RedisStore in socket.io

前端 未结 4 1937
故里飘歌
故里飘歌 2020-11-29 19:24

I am trying to scale a simple socket.io app across multiple processes and/or servers.

Socket.io supports RedisStore but I\'m confused as to how to use it.

I\

4条回答
  •  旧巷少年郎
    2020-11-29 19:54

    Also what is difference between configuring socket.io to use redisstore vs. creating your own redis client and set/get your own data?

    The difference is that, when you use 'RedisStore', the socket.io itself will save the socket heartbeat and session info into the Redis, and if you use cluster with node.js, the user client can work.

    Without redis, the client might change the node.js process next time, so the session will be lost.

提交回复
热议问题