ws-heartbeat
Version:
Server-side and client-side heartbeat library for ws and browser-side Websocket.
11 lines (10 loc) • 385 B
TypeScript
export type WsHeartbeatOption = Partial<{
pingInterval: number;
pingTimeout: number;
}>;
export type WebSocketBase = {
close: () => void;
send: (data: any) => void;
addEventListener: (name: "message" | "close", listener: (e: any) => void) => void;
};
export declare function setWsHeartbeat(ws: WebSocketBase, pingMessage: string, option?: WsHeartbeatOption): void;