The thing is that socket.get and socket.set are asynchronous, that's why
you must use a callback; still, you could easily get the value you need
on socket.on('disconnect', function(){}); like below, just remember to always use callbacks for setting and getting, since both operations are asynchronous and otherwise you risk the value not being set when you are getting it. Hope this helps.
var chatbox = io.on('connection',function(socket) {
// Use callback for setting the value as well
socket.set('id','woooooooow', function(){
//at this point you can be sure the value has been properly set
socket.on('disconnect',function() {
socket.get('id', function(error, value){
//the function returns an error and a value variable, check for errors and if none are present, then the value of 'id' should be in the "value" variable
var id = value; // 'woooooooow'
});
});
});
});