1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Remove websocket listeners on close

Fixes #285
This commit is contained in:
Nick O'Leary 2014-07-23 21:15:57 +01:00
parent 5179cc77f5
commit c079576e49

View File

@ -75,12 +75,14 @@ module.exports = function(RED) {
// Workaround https://github.com/einaros/ws/pull/253
// Remove listeners from RED.server
var listener = null;
for (var event = 0; event < node._serverListeners.length; event++) {
for(var event in node._serverListeners) {
if (node._serverListeners.hasOwnProperty(event)) {
listener = node._serverListeners[event];
if(typeof listener === "function"){
RED.server.removeListener(event,listener);
}
}
}
node._serverListeners = {};
node.server.close();