On This Page

ConnectionError

Class in Errors · JavaScript & TypeScript

Instance discovery or the gateway connection failed

Inspect phase, reason and status to distinguish network failure, invalid protocol data and gateway closure. The message includes a reviewed Fluxer close-code explanation when available, but no Fluxer response body or close-reason text. An explanation does not establish whether the session can resume or whether the SDK will retry. Local gateway receive-limit and UTF-8 failures use reason protocol and status 1009 and 1007 respectively. These failures and binary frames do not retry automatically. No rejected payload is retained. Other invalid gateway data, such as a frame that is not JSON or a sequence that goes backwards, is retried with a new session. Three such failures in a row without a healthy connection between them end the shard with reason protocol. Protocol failures name the violated opcode, dispatch type or field path in details when the SDK identified one

class ConnectionError extends FluxerlyErrorclass ConnectionError
  extends FluxerlyError

Constructor#

new ConnectionError(
    phase: "gateway" | "discovery",
    reason: "closed" | "network" | "protocol",
    status?: number | null,
    options?: {
        readonly cause?: unknown
        readonly details?:
            Readonly<Record<string, string | number | boolean>>
        readonly hint?: string
    }
): ConnectionErrornew ConnectionError(
  phase: "gateway" | "discovery",
  reason:
    | "closed" | "network"
    | "protocol",
  status?: number | null,
  options?: {
    readonly cause?: unknown
    readonly details?: Readonly<
      Record<
        string,
        string | number | boolean
      >
    >
    readonly hint?: string
  }
): ConnectionError

Parameters

phase

The transport stage that failed

"gateway" | "discovery"
reason

Network failure, invalid protocol data, or a closed gateway connection

"closed" | "network" | "protocol"
status optional

HTTP status during discovery or WebSocket close code at the gateway, including local receive rejection, or null when unavailable

number | null
options optional

Optional protocol facts and underlying transport cause

cause optional
unknown
details optional

Safe protocol facts such as opcode, dispatch type, field path or transport error code

Readonly<Record<string, string | number | boolean>>Readonly<
  Record<
    string,
    string | number | boolean
  >
>
hint optional
string

Properties#

_tag#

Discriminator for identifying an expected discovery or gateway connection failure

readonly _tag: "ConnectionError"

phase#

The transport stage that failed

readonly phase: "gateway" | "discovery"readonly phase:
  | "gateway" | "discovery"

reason#

Network failure, invalid protocol data, or a closed gateway connection

readonly reason: "closed" | "network" | "protocol"readonly reason:
  | "closed" | "network"
  | "protocol"

status#

HTTP status during discovery or WebSocket close code at the gateway, including local receive rejection, or null when unavailable

readonly status: number | null

Inherited#

Inherited from FluxerlyError: code, details, hint, toJSON