Cheap session-change watcher: re-scope the socket only when the active session * actually changes. Reads a property; no network at idle.
()
| 217 | /** Cheap session-change watcher: re-scope the socket only when the active session |
| 218 | * actually changes. Reads a property; no network at idle. */ |
| 219 | function watchSession(): void { |
| 220 | if (closed || !socket || socket.readyState !== WebSocket.OPEN) return; |
| 221 | const current = opts?.getSessionId() ?? null; |
| 222 | if (current === helloedSession) return; |
| 223 | // Re-hello with the new session; the server replaces this socket's sink scope. |
| 224 | const client = getRpcClient(); |
| 225 | void client?.resolveEndpoint().then((endpoint) => { |
| 226 | if (!socket || socket.readyState !== WebSocket.OPEN) return; |
| 227 | sendHello(socket, endpoint?.token ?? null); |
| 228 | }); |
| 229 | } |
nothing calls this directly
no test coverage detected