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
1 changed files with 6 additions and 1 deletions

View File

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