Websocket event handlers should not have to worry about emiting
'destory' event, that is the disposings job
};
Client.prototype.dispose = function () {
- websocketDisconnect.apply(this);
+ this.emit('destroy');
this.removeAllListeners();
};
cons[i] = null;
}
});
- this.emit('destroy');
+
+ this.dispose();
}
// TODO: Should this close all the websocket connections too?
function websocketError() {
- this.emit('destroy');
this.dispose();
}
\ No newline at end of file