* Dispatch a protobuf-encoded message. * Mirrors: ibapi/decoder.py processProtoBuf()
(protoBuf: Buffer, msgId: number)
| 69 | * Mirrors: ibapi/decoder.py processProtoBuf() |
| 70 | */ |
| 71 | processProtoBuf(protoBuf: Buffer, msgId: number): void { |
| 72 | if (msgId === 0) return |
| 73 | |
| 74 | const handler = this.msgId2protoHandler.get(msgId) |
| 75 | if (!handler) { |
| 76 | console.log(`[ibkr] unhandled protobuf message: msgId=${msgId}, len=${protoBuf.length}`) |
| 77 | return |
| 78 | } |
| 79 | |
| 80 | try { |
| 81 | handler(this, protoBuf) |
| 82 | } catch (e) { |
| 83 | if (e instanceof BadMessage) { |
| 84 | this.wrapper.error( |
| 85 | NO_VALID_ID, currentTimeMillis(), |
| 86 | BAD_MESSAGE.code(), BAD_MESSAGE.msg() + `protobuf msgId=${msgId}`, '', |
| 87 | ) |
| 88 | } |
| 89 | throw e |
| 90 | } |
| 91 | } |
| 92 | } |