Simple question, I'm new to using node.js and was curious as to how I should uniquely identify a computer?
Asked
Active
Viewed 2,441 times
7
-
Basically, how do I make sessions in node.js is really what I'm asking. Because if a user has two tabs open in their web browser id like those tabs to interact as well. – Travis Sep 04 '10 at 06:05
-
2Are you asking for HTTP requests? If so, try using a cookie. See this question: http://stackoverflow.com/questions/3393854/get-and-set-a-single-cookie-with-node-js-http-server – Rob Olmos Sep 04 '10 at 06:07
-
I guess its an http request ya ... I'm working with websockets – Travis Sep 04 '10 at 06:19
2 Answers
2
As with most operations you have no way to identify uniquely a computer. All data is sent stateless and wihout any information of the computer.
But you can change your (x)html application to store unique cookies so the client side part can authenticate to the server with the cookie, perfectly identifying two open tabs of one user.

Tobias P.
- 4,537
- 2
- 29
- 36
0
If you're working with web sockets you can assign each client an id using a random uuid, here's one that'll work on both client and server:
http://www.broofa.com/Tools/Math.uuid.js
and speed benchmarks for each flavor:

thejefflarson
- 71
- 4