Skip to main content
Version: 5.x.x

sseAdapter


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

Description

Defined in adapter/adapter.sse.ts:13

Preview

sseAdapter(socket, DO_NOT_USE)

Parameters

NameDetails

socket

Required

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

DO_NOT_USE

Optional

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

Returns

{
connect: () => void;
connecting: boolean;
disconnect: () => void;
emit: (eventMessageId: string, emitter: EmitterInstance, ack?: EmitterAcknowledgeType<any, SocketAdapterType<SSEAdapterOptionsType, MessageEvent<SocketData<any>>, never, never>>) => void;
listen: (listener: Listener<any, any, SocketAdapterType<SSEAdapterOptionsType, MessageEvent<SocketData<any>>, never, never>, false>, callback: ListenerCallbackType<SocketAdapterType<SSEAdapterOptionsType, 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;
}