Close the socket. Idempotent.
()
| 439 | |
| 440 | /** Close the socket. Idempotent. */ |
| 441 | async close(): Promise<void> { |
| 442 | for (const dispose of this._disposers.splice(0)) { |
| 443 | try { |
| 444 | dispose(); |
| 445 | } catch { |
| 446 | // ignore |
| 447 | } |
| 448 | } |
| 449 | if (this._ws) { |
| 450 | await this._ws.close(); |
| 451 | this._ws = null; |
| 452 | } |
| 453 | this._serverHello = null; |
| 454 | this._subscribed.clear(); |
| 455 | } |
| 456 | |
| 457 | // ── WS observation ────────────────────────────────────────────────────── |
| 458 | /** Subscribe to ALL incoming frames. Returns an unsubscribe handle. */ |