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

Add websocket error handlers

Fixes #190
This commit is contained in:
Nick O'Leary 2014-04-01 23:18:34 +01:00
parent 6cc0df75a6
commit fa2d2771a7
2 changed files with 10 additions and 0 deletions

View File

@ -94,6 +94,13 @@ DebugNode.wsServer.on('connection',function(ws) {
} }
} }
}); });
ws.on('error', function(err) {
util.log("[debug] ws error : "+err);
});
});
DebugNode.wsServer.on('error', function(err) {
util.log("[debug] ws server error : "+err);
}); });
DebugNode.logHandler = new events.EventEmitter(); DebugNode.logHandler = new events.EventEmitter();

View File

@ -66,6 +66,9 @@ function WebSocketListenerNode(n) {
socket.on('message',function(data,flags){ socket.on('message',function(data,flags){
node.handleEvent(id,socket,'message',data,flags); node.handleEvent(id,socket,'message',data,flags);
}); });
socket.on('error', function(err) {
node.warn("An error occured on the ws connection: "+inspect(err));
});
}); });
node.on("close", function() { node.on("close", function() {