/** * This module uses `JSON.stringify` and `JSON.parse` for a number of reasons: * * - I'm too lazy to figure out an efficient `ArrayBuffer` approach, that said * I can imagine it easy to make a hybrid... * - Historically the library used them out of paranoia and sloth (detecting * browser object clone support) * - Because apparently `JSON` is actually reasonable: * https://nolanlawson.com/2016/02/29/high-performance-web-worker-messages/ */ import { Remote, RemoteDesc, RPCAbstractConfig } from '@ch1/rpc'; export declare type NativeWebSocket = { addEventListener: (message: string, handler: (result: { data: any; }) => any) => any; send: (data: string) => any; }; export declare type WsWebSocket = { on: (message: string, callback: (data: any) => any) => any; send: (data: string) => any; }; /** * Socket RPC Config */ export interface RPCSocketConfig extends RPCAbstractConfig { pingDelay?: number; socket: NativeWebSocket | WsWebSocket; } export declare function create(config: RPCSocketConfig, remote?: Remote, remoteDesc?: RemoteDesc): { onDestroy: (...args: any[]) => (reason?: string) => void; ready: Promise<{}>; } | import("@ch1/rpc/dist/interfaces").RPC;