Socket.io has built-in methods for saving session server data for a given socket through socket.get, socket.setand socket.del. Where it stores this data, the storage device is used by default, but you can use redis, etc. Keep in mind that when the socket is disconnected, this data is not saved when reconnecting, so you will want to send client identification data using the socket installation event or during authorization.
This way, it leaves your client data that can be saved via localStorage, sessionStorage or regular old vanilla cookies, among others.
source
share