I am currently using socket.io v2.0.3 in node.js server and can't find a way to get client's IP address.
There are numerous of tips & tricks all around stackoverflow but they are outdated and not working anymore.
It is in the socket.handshake
{
headers: /* the headers sent as part of the handshake */,
time: /* the date of creation (as string) */,
address: /* the ip of the client */,
xdomain: /* whether the connection is cross-domain */,
secure: /* whether the connection is secure */,
issued: /* the date of creation (as unix timestamp) */,
url: /* the request URL string */,
query: /* the query object */
}
See this link
Edit: turns it it might have changed to socket.request.connection.remoteAddress, see this link.
Edit2 : Issue could be related to Client and Server version unaligned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With