siegel
Version:
Web application development ecosystem
19 lines (18 loc) • 686 B
TypeScript
import type { CreateSocketParams, Handler } from './types';
declare const SOCKET_CONNECTION_STATE: {
readonly CONNECTING: 0;
readonly OPEN: 1;
readonly CLOSING: 2;
readonly CLOSED: 3;
};
declare function createSocket(params: CreateSocketParams): {
on<_Payload>(messageType: string, cb: Handler<_Payload>): /*elided*/ any;
off(messageType: string, cb: Handler): /*elided*/ any;
allOff(messageType: string): /*elided*/ any;
send(messageType: string, payload: any): /*elided*/ any;
close(): /*elided*/ any;
getUnderlyingSocket: () => WebSocket;
};
export default createSocket;
export { SOCKET_CONNECTION_STATE };
export type { CreateSocketParams };