Is there a function to intercept all socket.io data from the server on clientside

socket.io clientside code can use this

  var socket = io('http://localhost:8888');
socket.on('news', function (data) {

    socket.emit('my other event', { my: 'data' });
});

but i want to intercept all data from the server emitted by socket.io not only news and then process the data. is that possible.

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..