do not reject messages

allow loose message sending, but prevent handling errors
This commit is contained in:
Brandon Nozaki Miller 2017-02-13 22:37:24 -08:00 committed by GitHub
parent 4f9f206b42
commit 4edd1d044e

View file

@ -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,