I am working on a multi-node socket.io app that uses Redis to store information about the devices connected.
When a user connects to the app, I store in Redis a hash with userID:socketID and another has with computerID:socketID. This allows me to quickly find out if a user is connected or if a specific computer is connected. However, if for some reason my socket.io server crashes I need this information to be deleted from Redis automatically. Also, if the Redis server crashes I need this deleted automatically. I guess I could use socket.io "Rooms", but I don't know how they would work in a multi-node environment.
I also have a tiny piece of information that needs persistence, so it is important that piece of information does not get deleted if any of the server crashes.
Is there a way to automatically delete specific data from Redis if my socket.io server, or the Redis server itself, go down?