react-use-websocket
Version:
React Hook for WebSocket communication
7 lines (6 loc) • 366 B
TypeScript
import { Options, WebSocketHook } from './types';
export interface SocketIOMessageData<T = unknown> {
type: string;
payload: T | null;
}
export declare const useSocketIO: <T = unknown>(url: string | (() => string | Promise<string>) | null, options?: Options, connect?: boolean) => WebSocketHook<SocketIOMessageData<T | null>, SocketIOMessageData<T | null>>;