Greetings, I am trying to issue an event in nodejs from a separate module, but I can not capture it, I have this code in the module
var util = require("util");
var events = require("events");
function MyStream (connection) {
if (!(this instanceof MyStream))
return new MyStream(connection);
events.EventEmitter.call(this);
var self = this;
self.emit('pulse', 'client pulse');
}
util.inherits(MyStream, events.EventEmitter);
exports.MyStream = MyStream;
and then from the main script I try to capture the event but I can not capture it
var server = require("./server");
var mystream = server.MyStream('aqui van los parametros');
mystream.on('pulse', function (data) {
console.log(data);
});
I'm not getting any errors either, any ideas? thanks