Interface: RetryContext
Context passed to a custom retryStrategy hook on each reconnect attempt.
Frozen via Object.freeze before invocation, handlers cannot mutate.
Example
const retryStrategy: RetryStrategy = (ctx) => {
if (ctx.attempt >= 5) return null;
if (ctx.classifiedAs === 'permanent') return null;
return Math.min(30_000, 1000 * (ctx.attempt + 1));
};
Properties
attempt
readonlyattempt:number
0-indexed attempt counter for the current reconnect cycle.
classifiedAs
readonlyclassifiedAs:"transient"|"permanent"
How the failure that triggered this reconnect attempt was classified.
lastDelayMs
readonlylastDelayMs:number
Delay used for the previous attempt (ms). 0 on the first attempt.
lastError
readonlylastError:Error
The error that triggered the disconnect.
signal
readonlysignal:AbortSignal
The same AbortSignal passed into connect(). If no signal was
supplied, the module-level NEVER_ABORTING_SIGNAL sentinel is provided
so handlers always have a real AbortSignal to inspect.
sinceLastSuccessMs
readonlysinceLastSuccessMs:number
Ms since the last successful ACK. Infinity if no success seen.
totalElapsedMs
readonlytotalElapsedMs:number
Total wall-clock ms elapsed since the disconnect that started this cycle.