in src/rpc.ts [307:331]
private dispatchIncoming(packet: RPCMessageWithCounter<any>) {
switch (packet.type) {
case 'method':
this.emit('recvMethod', packet);
if (this.listeners(packet.method).length > 0) {
this.emit(packet.method, packet);
return;
}
this.post({
type: 'reply',
serviceID: this.options.serviceId,
id: packet.id,
error: { code: 4003, message: `Unknown method name "${packet.method}"` },
result: null,
});
break;
case 'reply':
this.emit('recvReply', packet);
this.handleReply(packet);
break;
default:
// Ignore
}
}