我正在玩socket.io,我正试图在连接时尝试找到套接字对象的不同属性。
我发现this answer向我展示了socket.request.connection.remoteAddress属性,但是当我执行socket.request.connection对象的console.log时,remoteAddress未列为属性..
为什么console.log没有列出所有属性?是否有更好的方法来显示对象?
var io = require('socket.io').listen(server);
io.sockets.on('connection', function(socket){
console.log(socket.request.connection.remoteAddress); //works
console.log(socket.request.connection); //Doesn't show remoteAddress or remotePort
console.dir(socket.request.connection); //Same problem
});