GatewayReconnect
Defined in: packages/ws/src/reconnect.ts:107
Reconnect scheduling, backoff and attempt coordination.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GatewayReconnect(
options):GatewayReconnect
Defined in: packages/ws/src/reconnect.ts:118
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”GatewayReconnect
Accessors
Section titled “Accessors”attemptPromise
Section titled “attemptPromise”Get Signature
Section titled “Get Signature”get attemptPromise():
Promise<void> |undefined
Defined in: packages/ws/src/reconnect.ts:149
The in-flight attempt, or undefined when none is active.
Returns
Section titled “Returns”Promise<void> | undefined
attempts
Section titled “attempts”Get Signature
Section titled “Get Signature”get attempts():
number
Defined in: packages/ws/src/reconnect.ts:129
Consecutive attempts made since the last reset.
Returns
Section titled “Returns”number
connecting
Section titled “connecting”Get Signature
Section titled “Get Signature”get connecting():
boolean
Defined in: packages/ws/src/reconnect.ts:144
Whether a connection attempt is currently in flight.
Returns
Section titled “Returns”boolean
enabled
Section titled “enabled”Get Signature
Section titled “Get Signature”get enabled():
boolean
Defined in: packages/ws/src/reconnect.ts:124
Whether automatic reconnect is permitted.
Returns
Section titled “Returns”boolean
exhausted
Section titled “exhausted”Get Signature
Section titled “Get Signature”get exhausted():
boolean
Defined in: packages/ws/src/reconnect.ts:139
Whether the attempt budget is spent.
Returns
Section titled “Returns”boolean
pending
Section titled “pending”Get Signature
Section titled “Get Signature”get pending():
boolean
Defined in: packages/ws/src/reconnect.ts:134
Whether a reconnect timer is currently armed.
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”attempt()
Section titled “attempt()”attempt(
start):Promise<void>
Defined in: packages/ws/src/reconnect.ts:235
Coordinates one logical connection attempt.
Callers that ask while an attempt is in flight join it instead of
starting a second: three connect() calls produce one socket attempt and
one shared promise.
Parameters
Section titled “Parameters”() => void
Invoked exactly once, when this call begins a new attempt.
Returns
Section titled “Returns”Promise<void>
cancel()
Section titled “cancel()”cancel():
void
Defined in: packages/ws/src/reconnect.ts:216
Cancels an armed reconnect. Safe to call when none is armed.
Returns
Section titled “Returns”void
canReconnect()
Section titled “canReconnect()”canReconnect():
boolean
Defined in: packages/ws/src/reconnect.ts:159
Whether another reconnect is currently allowed.
Returns
Section titled “Returns”boolean
classifyClose()
Section titled “classifyClose()”classifyClose(
code,canResume):CloseAction
Defined in: packages/ws/src/reconnect.ts:154
Classifies a close code against this Gateway’s policy.
Parameters
Section titled “Parameters”number
canResume
Section titled “canResume”boolean
Returns
Section titled “Returns”reset()
Section titled “reset()”reset():
void
Defined in: packages/ws/src/reconnect.ts:222
Clears the attempt counter after a connection succeeds.
Returns
Section titled “Returns”void
schedule()
Section titled “schedule()”schedule(
run):ScheduleResult
Defined in: packages/ws/src/reconnect.ts:170
Arms a reconnect, unless one is already armed or no attempt is allowed.
Refusing while pending is what keeps repeated closes from stacking
timers: several closes in a row produce one reconnect, not several
competing sockets.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”settle()
Section titled “settle()”settle(
error?):void
Defined in: packages/ws/src/reconnect.ts:246
Settles the in-flight attempt, resolving it or rejecting with error.
Parameters
Section titled “Parameters”error?
Section titled “error?”Error
Returns
Section titled “Returns”void