In Node.js is there any way to listen to all events emitted by an EventEmitter object?
e.g., can you do something like...
event_emitter.on(\
Here's a debug tool inspired by Martin's answer (https://stackoverflow.com/a/18087021/1264797). I just now used this to figure out what was going wrong in a set of streams by logging all of their events to the console. Works great. As Martin illustrates, OP could use it by replacing the console.log() call with a websocket sender.
function debug_emitter(emitter, name) {
var orig_emit = emitter.emit;
emitter.emit = function() {
var emitArgs = arguments;
console.log("emitter " + name + " " + util.inspect(emitArgs));
orig_emit.apply(emitter, arguments);
}
}