Using the latest 1.0.6
version of Socket.IO
and have my app deployed on Heroku
, I get the client IP
and port
using the headers
into the socket handshake
:
var socketio = require('socket.io').listen(server);
socketio.on('connection', function(socket) {
var sHeaders = socket.handshake.headers;
console.info('[%s:%s] CONNECT', sHeaders['x-forwarded-for'], sHeaders['x-forwarded-port']);
}