socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

multi-server using store redis to sync session. when disconnected what will happen?

Open letiennam29 opened this issue 12 years ago • 3 comments

Hi everybody, I have a question.

I have 2 server socket.io and sync session by store redis. So i have 1 client connect then 2 server will contain same session.

But when i disconnect, Are both servers delete session?

letiennam29 avatar Mar 13 '14 10:03 letiennam29

They should delete the session, but they do not. Check out this links: https://github.com/LearnBoost/socket.io/issues/831 https://github.com/SpiderStrategies/socket.io/commit/caa96a5cc207aaff23db94a03a2412f5a8c8a4f6 https://github.com/observing/socket.io/commit/6d458d86697ddd8b10f68905fec02ca9feb3541c

I applied the changes proposed in these links to avoid memory issues caused by socket object references.

nicoburghi avatar Mar 13 '14 12:03 nicoburghi

As you're using the RedisStore you might also be interested in reading this: https://medium.com/p/2c8ad1153332 before considering using it in production.

radicans avatar Mar 13 '14 12:03 radicans

tks @nicoburghi , @radicans I have do manual by: When disconnect at a server. I using pub/sub redis for sync "socket.id" to other server. then call function "socket.disconnect()"

That's ok!

letiennam29 avatar Mar 14 '14 02:03 letiennam29