(msg: TerminalAttachMessage)
| 541 | } |
| 542 | |
| 543 | private onTerminalAttach(msg: TerminalAttachMessage): void { |
| 544 | if (this.terminalHandler === undefined) { |
| 545 | this.send(buildAck(msg.id, ErrorCode.INTERNAL_ERROR, 'terminal handler not wired', {})); |
| 546 | return; |
| 547 | } |
| 548 | const { session_id, terminal_id, since_seq } = msg.payload; |
| 549 | this.terminalHandler |
| 550 | .attach(session_id, terminal_id, this, { sinceSeq: since_seq }) |
| 551 | .then((result) => { |
| 552 | this.send(buildAck(msg.id, 0, 'success', { |
| 553 | attached: true, |
| 554 | replayed: result.replayed, |
| 555 | })); |
| 556 | }) |
| 557 | .catch((err: unknown) => { |
| 558 | this.sendTerminalErrorAck(msg.id, err, 'terminal_attach failed'); |
| 559 | }); |
| 560 | } |
| 561 | |
| 562 | private onTerminalDetach(msg: TerminalDetachMessage): void { |
| 563 | if (this.terminalHandler === undefined) { |
no test coverage detected