Is it possible to have a socket.io client respond to all events without to have specify each event individually?
For example, something like this (which obviously do
@Matthias Hopf answer
Updated answer for v1.3.5. There was a bug with args, if you wanna listen on old event and *
event together.
var Emitter = require('events').EventEmitter;
var emit = Emitter.prototype.emit;
// [...]
var onevent = socket.onevent;
socket.onevent = function (packet) {
var args = packet.data || [];
onevent.call (this, packet); // original call
emit.apply (this, ["*"].concat(args)); // additional call to catch-all
};