@squidcloud/client
Version:
A typescript implementation of the Squid client
27 lines (26 loc) • 821 B
TypeScript
interface Options {
maxAttempts?: number;
protocols?: string[];
onmessage?: (event: any) => void;
onopen?: (event: any) => void;
onclose?: (event: any) => void;
onerror?: (event: any) => void;
onreconnect?: (event: any) => void;
onmaximum?: (event: any) => void;
timeoutMillis?: number;
}
export interface WebSocketWrapper {
open: () => void;
reconnect: (e: any) => void;
json: (x: any) => void;
send: (x: string) => void;
close: (x?: number, y?: string) => void;
connected: boolean;
/**
* Websocket is explicitly closed by calling socket.close().
* Used to ignore errors after socket.closed() is called.
*/
closeCalled: boolean;
}
export declare function createWebSocketWrapper(url: string, opts?: Options): WebSocketWrapper;
export {};