Support for receiving null messages
Just log em for debugging. Also update the error messge thrown when we get a content message with no supported properties. It may be empty or may just have an unrecognized field. // FREEBIE
This commit is contained in:
parent
243fd68904
commit
bb9c97b960
2 changed files with 14 additions and 2 deletions
|
@ -38444,11 +38444,17 @@ MessageReceiver.prototype.extend({
|
||||||
return this.handleSyncMessage(envelope, content.syncMessage);
|
return this.handleSyncMessage(envelope, content.syncMessage);
|
||||||
} else if (content.dataMessage) {
|
} else if (content.dataMessage) {
|
||||||
return this.handleDataMessage(envelope, content.dataMessage);
|
return this.handleDataMessage(envelope, content.dataMessage);
|
||||||
|
} else if (content.nullMessage) {
|
||||||
|
return this.handleNullMessage(envelope, content.nullMessage);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Got Content message with no dataMessage and no syncMessage');
|
throw new Error('Unsupported content message');
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
handleNullMessage: function(envelope, nullMessage) {
|
||||||
|
var encodedNumber = envelope.source + '.' + envelope.sourceDevice;
|
||||||
|
console.log('null message from', encodedNumber, envelope.timestamp.toNumber());
|
||||||
|
},
|
||||||
handleSyncMessage: function(envelope, syncMessage) {
|
handleSyncMessage: function(envelope, syncMessage) {
|
||||||
if (envelope.source !== this.number) {
|
if (envelope.source !== this.number) {
|
||||||
throw new Error('Received sync message from another number');
|
throw new Error('Received sync message from another number');
|
||||||
|
|
|
@ -235,11 +235,17 @@ MessageReceiver.prototype.extend({
|
||||||
return this.handleSyncMessage(envelope, content.syncMessage);
|
return this.handleSyncMessage(envelope, content.syncMessage);
|
||||||
} else if (content.dataMessage) {
|
} else if (content.dataMessage) {
|
||||||
return this.handleDataMessage(envelope, content.dataMessage);
|
return this.handleDataMessage(envelope, content.dataMessage);
|
||||||
|
} else if (content.nullMessage) {
|
||||||
|
return this.handleNullMessage(envelope, content.nullMessage);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Got Content message with no dataMessage and no syncMessage');
|
throw new Error('Unsupported content message');
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
handleNullMessage: function(envelope, nullMessage) {
|
||||||
|
var encodedNumber = envelope.source + '.' + envelope.sourceDevice;
|
||||||
|
console.log('null message from', encodedNumber, envelope.timestamp.toNumber());
|
||||||
|
},
|
||||||
handleSyncMessage: function(envelope, syncMessage) {
|
handleSyncMessage: function(envelope, syncMessage) {
|
||||||
if (envelope.source !== this.number) {
|
if (envelope.source !== this.number) {
|
||||||
throw new Error('Received sync message from another number');
|
throw new Error('Received sync message from another number');
|
||||||
|
|
Loading…
Reference in a new issue