diff --git a/nodes/core/io/22-websocket.js b/nodes/core/io/22-websocket.js index 6e26a1395..768d09bfe 100644 --- a/nodes/core/io/22-websocket.js +++ b/nodes/core/io/22-websocket.js @@ -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