What you want is to register for all events emitted by "socket".
This issue was widely discussed here. It's a no go in the socket.io code, but commenters suggest some ways to do it.
Your best bet is probably to follow this path :
(function() {
var emit = socket.emit;
socket.emit = function() {
console.log('***','emit', Array.prototype.slice.call(arguments));
emit.apply(socket, arguments);
};
var $emit = socket.$emit;
socket.$emit = function() {
console.log('***','on',Array.prototype.slice.call(arguments));
$emit.apply(socket, arguments);
};
})();
Please look at the linked topic for more informations.
You may find additional informations here on some other ways to do it..