GeminiLiveReconnectPolicy class
Configuration policy for automatic session reconnection and resumption
when a Gemini Live WebSocket session receives a GoAway notice or closes unexpectedly.
Constructors
- GeminiLiveReconnectPolicy({int maxAttempts = 3, Duration initialDelay = const Duration(milliseconds: 500), Duration maxDelay = const Duration(seconds: 8), double backoffMultiplier = 2.0, bool reconnectOnGoAway = true, bool reconnectOnAbnormalClose = true})
-
Creates an exponential backoff reconnection policy for Gemini Live sessions.
const
Properties
- backoffMultiplier → double
-
Exponential multiplier applied after each failed attempt.
Defaults to
2.0.final - hashCode → int
-
The hash code for this object.
no setterinherited
- initialDelay → Duration
-
Initial delay before the first reconnection attempt.
Defaults to 500 milliseconds.
final
- maxAttempts → int
-
Maximum number of consecutive reconnection attempts before giving up.
Defaults to
3.final - maxDelay → Duration
-
Maximum backoff delay cap between reconnection attempts.
Defaults to 8 seconds.
final
- reconnectOnAbnormalClose → bool
-
Whether to automatically reconnect when the WebSocket closes with a non-normal
close code (i.e. closeCode != 1000). Defaults to
true.final - reconnectOnGoAway → bool
-
Whether to proactively reconnect using the latest session resumption handle
when the server emits a
GoAwaymessage. Defaults totrue.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
delayForAttempt(
int attempt) → Duration -
Computes the backoff delay for the given 0-indexed
attempt. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited