Looking at the socket.io code, it seems like the user id uniquely identifies the socket client. See, for example, Socket.connect code:
Socket.prototype.onconnect = function(){ debug('socket connected - writing packet'); this.join(this.id); this.packet({ type: parser.CONNECT }); this.nsp.connected[this.id] = this; };
On the last line, the identifier is used in a hash that tracks connected sockets. Since you need your identifiers to be unique, each identifier is unique if the server has not been restarted.
source share