My application is running on ec2 instance. we are using node.js for server side code. We are using socket.io, express to connect the client side code.I have a requirement to capture user's browser ip and send it to server side code. i have tried the below code but it is giving me the server IP details.
io.sockets.on('connection', function (socket) {
var socketId = socket.id;
var clientIp = socket.handshake.headers;
console.log('connection :', socket.request.connection._peername);
console.log(socket.request.client._peername.address);
console.log(clientIp);
});
Is there any ways to capture the user's browser IP, it will be great help. I appreciate your suggestions.