I wanted to have a console log of each socket message being sent down to the server, so I quickly wrapped socket.io's socket.emit function
var self = this;
this.socket = io.connect();
this.socket._emit = this.socket.emit;
this.socket.emit = function(){
console.log(...arguments[0]);
self.socket._emit(...arguments);
};
It works fine except for some bizarre console log printing. This happens on Chrome and Firefox. What is going on?
I did fix this by using arguments[0] instead of ...arguments[0] but I'm still curious..
