0

I was going through this question: socket.io determine if a user is online or offline.

In the answer I have seen that an object containing the online users is created. In a production app should you store this data in a database like redis? Or is it okay if it stays saved in memory in the server?

YulePale
  • 6,688
  • 16
  • 46
  • 95

1 Answers1

1

I would not store the users in the server's memory, imagine this case:

for some reason you need to restart the server, a crash, a new version update, a new release and the memory of the server gets reset and you loose the users object.

So for this redis looks like a great option to store users data.

Sebas Tian
  • 99
  • 4
  • @sebbas Tian can you please give some example in which form or structure we have to store online and offline user detail in redis. – Akshay Kumar Oct 11 '20 at 21:44