Skip to main content
Version: v8.0.0

SSEAdapterOptionsType


Import
import { SSEAdapterOptionsType } from "@hyper-fetch/sockets"

Preview​

type SSEAdapterOptionsType = {
autoConnect?: boolean;
decode?: (event: MessageEvent) => SSEDecodedMessageType | null;
eventSourceInit?: EventSourceInit;
}

Structure​

SSEAdapterOptionsType
NameTypeDescription
autoConnect
boolean
eventSourceInit
EventSourceInit
decode
(event: MessageEvent) => SSEDecodedMessageType | null

Turns an incoming message into a listener event - use it when the server does not send { topic, data }

(e.g. { type, payload } ). Return null to ignore the message. Defaults to parsing the message as JSON and reading its topic and data fields.