Send `unsubscribe` and await its ack.
(sid: string)
| 424 | |
| 425 | /** Send `unsubscribe` and await its ack. */ |
| 426 | async unsubscribe(sid: string): Promise<void> { |
| 427 | const ws = this._requireWs(); |
| 428 | if (!this._subscribed.has(sid)) return; |
| 429 | const id = `unsub-${ulid()}`; |
| 430 | const ack = await ws.sendAndAwaitAck( |
| 431 | { type: 'unsubscribe', id, payload: { session_ids: [sid] } }, |
| 432 | this._controlAckTimeoutMs, |
| 433 | ); |
| 434 | if (ack.code !== 0) { |
| 435 | throw new Error(`unsubscribe rejected (code=${ack.code}): ${ack.msg ?? 'no message'}`); |
| 436 | } |
| 437 | this._subscribed.delete(sid); |
| 438 | } |
| 439 | |
| 440 | /** Close the socket. Idempotent. */ |
| 441 | async close(): Promise<void> { |
nothing calls this directly
no test coverage detected