mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Do not crash on malformed json message on websocket.
This commit is contained in:
parent
6bc4b235bb
commit
8506fd0c4b
@ -50,7 +50,13 @@ function start() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
ws.on('message', function(data,flags) {
|
ws.on('message', function(data,flags) {
|
||||||
var msg = JSON.parse(data);
|
var msg = null;
|
||||||
|
try {
|
||||||
|
msg = JSON.parse(data);
|
||||||
|
} catch(err) {
|
||||||
|
util.log("[red:comms] received malformed message : "+err.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (msg.subscribe) {
|
if (msg.subscribe) {
|
||||||
handleRemoteSubscription(ws,msg.subscribe);
|
handleRemoteSubscription(ws,msg.subscribe);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user