Skip to main content
Version: v8.0.0

ConnectCallbackType

Interceptor invoked before every connection attempt (initial, automatic reconnect, manual reconnect). Receives the connection details and must return them - modified or not. May be async.

attempt is 0 for a fresh connection and the reconnection attempt number otherwise.


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

Preview

type ConnectCallbackType<Adapter> = (data: { attempt: number; connection: SocketConnectionType<Adapter> }) => SocketConnectionType<Adapter> | Promise<SocketConnectionType<Adapter>>;