Is there a way to retrieve the clients IP address? #168

ghost opened this Issue Dec 31, 2011 · 5 comments

3 participants


Before each transaction, is it possible to have a function fired as an event?

Also, I am looking for a way to get the client's ip address in nowJS. Is this information integrated in this module or I have to access it with




By transaction, what do you mean? Certainly you have nowjs events as well as group events. So, uh, probably. There are also the undocumented events multicall and closurecall. I can't see it being too difficult to add yet another event for function calls, but I'm not sure it'd be particularly useful.

And for the second: I believe that it's user.socket.handshake.address, where user is a user object.


@steveWang hey Steve, i'm currently doing something about the cookies. you know that this.user.cookie = socket.handshake.headers.cookie but the cookie stores nothing, it's {}. what's that for or what's under socket.handshake?


It's not actually synchronized with the client's cookie; it only stores data that was in the user's cookie when the user connected. So if you were to store something in document.cookie on the user side, it'd show up the next time the user connected. This is mostly used for persistence and whatnot.

Also, socket.handshake just contains the details of the handshake when the user connects. Not much to it. It's entirely done on Socket.IO's end, if you want to look more into it.


By transactions I was meaning every time data is sent or received. Thanks for your answer.


Closing. Feel free to reopen if there are additional issues.

@ericz ericz closed this Jan 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment