I cannot get the remote address of a socket with node 0.11 I tried all these methods:
socket.io: get client's IP address
var io = require("socket.io").listen(server);
io.sockets.on("connection", function (socket) {
var address = socket.handshake.address;
console.log("New connection from " + address.address + ":" + address.port);
}
var socket = io.listen(server);
socket.on('connection', function(client){
var ip_address = client.connection.remoteAddress;
}
var http = require('http')
, io = require('socket.io');
io.listen(new http.Server().on('connection', function(sock) {
console.log('Client connected from: ' + sock.remoteAddress);
}).listen(80));
var io = require('socket.io').listen(80);
io.sockets.on('connection', function (socket) {
var endpoint = socket.manager.handshaken[socket.id].address;
console.log('Client connected from: ' + endpoint.address + ":" + endpoint.port);
});
All these methods give me undefined. It worked fine with node 0.7
ANy clue ?