()
| 34 | } |
| 35 | |
| 36 | async connect(): Promise<BackendHandle> { |
| 37 | const wsUrl = toWebSocketUrl(this.#url); |
| 38 | // Probe /health before constructing the RPC stub. capnweb's |
| 39 | // WebSocket session queues calls until the upgrade succeeds, |
| 40 | // so we'd otherwise discover a misconfigured URL only on the |
| 41 | // first RPC. The probe surfaces "harness forgot to start the |
| 42 | // container" up front. |
| 43 | await probeHealth(this.#url); |
| 44 | const client = createWorkspaceClient({ url: `${wsUrl}/ws` }); |
| 45 | return { |
| 46 | rpc: client, |
| 47 | close: async () => { |
| 48 | await client.close(); |
| 49 | }, |
| 50 | }; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | function toWebSocketUrl(input: string): string { |
nothing calls this directly
no test coverage detected