From 4edd1d044edad06cc27cb100d28f065bc6db3bbe Mon Sep 17 00:00:00 2001 From: Brandon Nozaki Miller Date: Mon, 13 Feb 2017 22:37:24 -0800 Subject: [PATCH] do not reject messages allow loose message sending, but prevent handling errors --- dao/socketServer.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/dao/socketServer.js b/dao/socketServer.js index 4e01e52..0296196 100644 --- a/dao/socketServer.js +++ b/dao/socketServer.js @@ -176,18 +176,13 @@ function gotData(socket,data,UDPSocket){ let message=new Message; message.load(data.shift()); - // In case either `type` or `data` is missing we won't process this message. - if (message.type === undefined || message.data === undefined) { - this.log('Message is missing either `type` or `data` property, skipping message.'); - continue; + // Only set the sock id if it is specified. + if (message.data && message.data.id){ + sock.id=message.data.id; } this.log('received event of : ',message.type,message.data); - if(message.data.id){ - sock.id=message.data.id; - } - this.publish( message.type, message.data,