hi I have the following code:
this.stop = function() {
this.server.close();
var thisServer = this;
this.server.on('close',function() {
thisServer.emit('stop');
});
};
after using the server and calling the stop function, the server refuses
to emit ‘close’ event and
this.server.on('close',function() {
thisServer.emit('stop');
});
am I doing something wrong?
Bind the close event before you invoke close.
Alternatively try
this.server.destroy();