hoxa
Version:
A comprehensive collection of 100+ production-ready React hooks for state management, UI effects, forms, animations, and more. Carefully curated and optimized for performance and developer experience.
15 lines (14 loc) • 429 B
TypeScript
export declare function useWebSocket<T = any>(url: string, options?: {
onOpen?: (event: Event) => void;
onClose?: (event: CloseEvent) => void;
onError?: (event: Event) => void;
reconnect?: boolean;
reconnectInterval?: number;
}): {
data: T | null;
send: (payload: any) => void;
readyState: number;
lastMessage: MessageEvent<any> | null;
connect: () => void;
disconnect: () => void;
};