Skip to main content
Version: 5.x.x

getSocketAdapterBindings


import { getSocketAdapterBindings } from "@hyper-fetch/sockets"

Description

Defined in adapter/adapter.bindings.ts:6

Preview

getSocketAdapterBindings<T>(socket, defaults)

Parameters

NameDetails

socket

Required

SocketInstance

defaults

Optional

{ connecting?: boolean; forceClosed?: boolean; open?: boolean; reconnectionAttempts?: number }

Returns

{
connecting: boolean;
forceClosed: boolean;
listeners: Map<string, Map<ListenerCallbackType<T, any>, VoidFunction>>;
onClose: () => void;
onConnect: () => boolean;
onDisconnect: () => boolean;
onEmit: (emitter: EmitterInstance) => boolean;
onError: (event: Error) => void;
onEvent: (endpoint: string, response: any, resposeExtra: ExtractSocketExtraType<T>) => void;
onListen: (listener: Pick<ListenerInstance, endpoint>, callback: ListenerCallbackType<T, any>, unmount: VoidFunction) => () => void;
onOpen: () => void;
onReconnect: (disconnect: () => void, connect: () => void) => boolean;
open: boolean;
reconnectionAttempts: number;
removeListener: (endpoint: string, callback: ListenerCallbackType<T, any>) => boolean;
}