| 1 | import { WsRpcGroup } from "@t3tools/contracts"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import { RpcClient } from "effect/rpc"; |
| 4 | |
| 5 | export const makeWsRpcProtocolClient = RpcClient.make(WsRpcGroup); |
| 6 | type RpcClientFactory = typeof makeWsRpcProtocolClient; |
| 7 | export type WsRpcProtocolClient = |
| 8 | RpcClientFactory extends Effect.Effect<infer Client, any, any> ? Client : never; |
| 9 | |
| 10 | // Pings go out every 5 seconds, and a server busy for a few seconds stops |
| 11 | // answering them. Allow 15 seconds without any frame before dropping the socket. |
| 12 | export const PING_TIMEOUT = "15 seconds"; |