useEventMessages
import { useEventMessages } from "@hyper-fetch/react"
Description
Defined in react/src/hooks/use-event-messages/use-event-messages.hooks.ts:15
Preview
useEventMessages<ResponsesType>(socket, options)
Parameters
Returns
{
connected: boolean;
connecting: boolean;
data: unknown;
onClose: (callback: VoidFunction) => void;
onConnecting: (callback: VoidFunction) => void;
onError: (callback: (event: ErrorType) => void) => void;
onEvent: (callback: (data: ResponsesType, event: MessageEvent<ResponsesType>) => void) => void;
onOpen: (callback: VoidFunction) => void;
onReconnecting: (callback: (attempts: number) => void) => void;
onReconnectingStop: (callback: (attempts: number) => void) => void;
setConnected: (connected: boolean) => void;
setConnecting: (connecting: boolean) => void;
setData: (data: unknown) => void;
setTimestamp: (timestamp: number) => void;
timestamp: number;
}