Skip to main content
Version: 5.x.x

websocketAdapter


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

Description

Defined in adapter/adapter.websocket.ts:21

Preview

websocketAdapter(socket, DO_NOT_USE)

Parameters

NameDetails

socket

Required

Socket<SocketAdapterType<WSAdapterOptionsType, MessageEvent<SocketData<any>>, never, never>>

DO_NOT_USE

Optional

{ adapterExtra?: MessageEvent<SocketData<any>>; adapterOptions?: WSAdapterOptionsType; emitterOptions?: never; listenerOptions?: never }

Returns

{
connect: () => void;
connecting: boolean;
disconnect: () => void;
emit: (eventMessageId: string, emitter: EmitterInstance, ack?: EmitterAcknowledgeType<any, SocketAdapterType<WSAdapterOptionsType, MessageEvent<SocketData<any>>, never, never>>) => void;
listen: (listener: Listener<any, any, SocketAdapterType<WSAdapterOptionsType, MessageEvent<SocketData<any>>, never, never>, false>, callback: ListenerCallbackType<SocketAdapterType<WSAdapterOptionsType, MessageEvent<SocketData<any>>, never, never>, any>) => RemoveListenerCallbackType;
listeners: Map<string, Map<ListenerCallbackType<SocketAdapterInstance, any>, VoidFunction>>;
open: boolean;
reconnect: () => void;
reconnectionAttempts: number;
removeListener: (endpoint: string, callback: (...args: any) => void) => void;
}