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

tray/catch error in Websocket node to close #264

This commit is contained in:
Dave C-J 2014-07-13 17:39:56 +01:00
parent bc53d302ff
commit 62496d80d5

View File

@ -96,7 +96,12 @@ module.exports = function(RED) {
WebSocketListenerNode.prototype.handleEvent = function(id,/*socket*/socket,/*String*/event,/*Object*/data,/*Object*/flags){ WebSocketListenerNode.prototype.handleEvent = function(id,/*socket*/socket,/*String*/event,/*Object*/data,/*Object*/flags){
var msg; var msg;
if (this.wholemsg) { if (this.wholemsg) {
try {
msg = JSON.parse(data); msg = JSON.parse(data);
}
catch(err) {
msg = { payload:data };
}
} else { } else {
msg = { msg = {
payload:data payload:data