Skip to main content
Version: v10.0.0

ReconnectingConnectionOptionsType


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

Preview​

type ReconnectingConnectionOptionsType<Adapter> = {
autoConnect?: boolean;
bindings: ReturnType<typeof getAdapterBindings>;
open: (attempt: ConnectionAttemptType<Adapter>) => ConnectionTransportType | null;
shouldReconnect?: ShouldReconnectType;
}

Structure​

ReconnectingConnectionOptionsType
NameTypeDescription
autoConnect
boolean

Connect when the engine is created.

bindings
ReturnType<typeof getAdapterBindings>

Bindings of the adapter's connector

open
(attempt: ConnectionAttemptType<Adapter>) => ConnectionTransportType | null

Opens the transport of an attempt. Return null when it can't be created - after reporting it with

onConnectFailed

  • and no retry follows.
shouldReconnect
ShouldReconnectType

The protocol's default for retried closes, e.g. its fatal close codes. The socket's shouldReconnect wins. Without it a normal closure (1000) stays closed and every other loss is retried ( defaultShouldReconnect ).