* Install a handler invoked on every `event.question.requested` frame. * Returns an unsubscribe handle (also auto-disposed by `close()`).
(
handler: (req: QuestionRequest) => Promise<QuestionResponse> | QuestionResponse,
)
| 579 | * Returns an unsubscribe handle (also auto-disposed by `close()`). |
| 580 | */ |
| 581 | onQuestionAsked( |
| 582 | handler: (req: QuestionRequest) => Promise<QuestionResponse> | QuestionResponse, |
| 583 | ): () => void { |
| 584 | const ws = this._requireWs(); |
| 585 | const unsubscribe = installReverseRpcHandler<QuestionRequest, QuestionResponse>(ws, { |
| 586 | requestEventType: 'event.question.requested', |
| 587 | idField: 'question_id', |
| 588 | buildPath: (sid, qid) => `/sessions/${sid}/questions/${qid}`, |
| 589 | handler, |
| 590 | postResolve: (sid, qid, body) => this.http.resolveQuestion(sid, qid, body), |
| 591 | logger: this._logger, |
| 592 | }); |
| 593 | this._disposers.push(unsubscribe); |
| 594 | return () => { |
| 595 | const idx = this._disposers.indexOf(unsubscribe); |
| 596 | if (idx >= 0) this._disposers.splice(idx, 1); |
| 597 | unsubscribe(); |
| 598 | }; |
| 599 | } |
| 600 | |
| 601 | // ── High-level convenience ────────────────────────────────────────────── |
| 602 | /** |
nothing calls this directly
no test coverage detected