Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/client / reconnect

reconnect

Pure-functional reconnect-backoff helper. Encapsulated in its own module so the GraphorinClient stays free of timing heuristics — and so tests can drive the policy with a deterministic RNG.

Algorithm: exponential backoff with full-jitter (delay = random(0, min(maxMs, baseMs * 2^attempt))). The implementation matches the AWS Architecture Blog "exponential backoff and jitter" reference but is otherwise an original formulation.

Interfaces

InterfaceDescription
BackoffPolicyStable shape consumed by computeBackoffMs.

Functions

FunctionDescription
computeBackoffMsCompute the number of milliseconds to sleep before the attempt-th reconnect (1-indexed). Returns null when the policy has been exhausted (attempt > maxAttempts).
sleepResolve when the requested number of milliseconds elapsed, or reject (with a DOMException-style abort error) when the supplied AbortSignal fires first.