How to get details of the user that sent data (.emit()) to nodejs server?

I'm experimenting on an app that is running with nodejs, express and socket.io

Server Side:

var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);

io.on('connection', function(socket){

    socket.on('send_stuff', function(stuff){

        io.emit('log_stuff',newStuff);

    });

});

http.listen(54123, function(){
    console.log('listening on *:54123');
});

Client Side:

var socket = io.connect('http://example.com:12345');
socket.emit('send_stuff',stuff);

My question is How do I get the details of the client (ip,user-agent,etc.) that executed socket.emit('send_stuff',stuff)?

I want to pass it to the newStuff variable.

socket.on('send_stuff', function(stuff){}); in this line stuff only returns the value that was send by client emit().

Any ideas how to do this?

You can get client's ip and user-agent in connection event.

io.on('connection', function(socket){
  console.log("ip: "+socket.request.connection.remoteAddress);
  console.log("user-agent: "+socket.request.headers['user-agent']);
})

Documentation can give you some hints http://socket.io/docs/server-api/