Smitha Smitha - 1 year ago 121
Node.js Question

How unique is

I'm building an application where I'd like a unique identifier for every connection for the duration that the app is running and I'm wondering if works for this. E.g. if user 1 disconnects from the application, user 2 who connects later shouldn't have the same that user 1 had before even though user 1 is no longer connected. Are socket ids unique for the entire time is listening to the server?

Answer Source

Assuming that you're using (which is the present version in NPM), the code that generates a new id for each connection/client can be found here.

I think that you can safely assume that each socket id is going to be unique.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download