ReconnectPolicy class

Computes reconnect delays with exponential backoff and jitter.

The node uses this to space out reconnection attempts after the Hub connection drops: the delay starts at initial, multiplies by factor each attempt up to maxDelay, and is perturbed by up to jitter fraction to avoid thundering herds. A successful, durable connection should call reset.

Constructors

ReconnectPolicy({Duration initial = const Duration(seconds: 1), Duration maxDelay = const Duration(seconds: 30), double factor = 2.0, double jitter = 0.2, Random? random})
Creates a reconnect policy.

Properties

attempt → int
The number of attempts since the last reset.
no setter
factor → double
The multiplier applied each attempt.
final
hashCode → int
The hash code for this object.
no setterinherited
initial → Duration
The delay before the first reconnect attempt.
final
jitter → double
The maximum random jitter as a fraction of the computed delay (0–1).
final
maxDelay → Duration
The cap on the delay.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

nextDelay() → Duration
Returns the next backoff delay and advances the attempt counter.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets the backoff after a healthy connection.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited