* Registers a handler that fires every time the underlying WebSocket * transitions to OPEN — including the very first successful connect. * * If the socket is already connected at call time, the handler is called * synchronously before this method returns, then added to the set so it
(handler: () => void)
| 323 | this.acquireCount--; |
| 324 | if (this.acquireCount === 0) { |
| 325 | this.disconnect(); |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | isConnected(): boolean { |
| 330 | return this.connected && this.ws !== null && this.ws.readyState === WebSocket.OPEN; |
| 331 | } |
| 332 | |
| 333 | subscribe(contexts: string[]): void { |
| 334 | const newlyActive: string[] = []; |
| 335 | for (const ctx of contexts) { |
| 336 | const next = (this.activeContexts.get(ctx) ?? 0) + 1; |
no test coverage detected