ReconnectPolicy class
The Reconnect Policy intended for use by a ClientSocket
to determine what
to do if a connection to the socket server fails.
If autoReconnect is true, the delay before reconnecting is calculated iteratively based on the number of attempts that have already been made to reconnect since the connection has been lost.
The following formula is used to work out the timeout before re-connecting:
timeout = round(
round(initialDelay + (randomness * random())) * (multiplier ^ attempts)
)
where attempts is the number of attempts.
If timeout > maxDelay, timeout will simply be set to maxDelay.
Constructors
Properties
- autoReconnect → bool
-
Whether or not to automatically reconnect the socket when it loses the
connection to the server.
Default is true.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialDelay → int
-
The minimum delay to wait before attempting to reconnect to the socket
server in milliseconds.
Default is 10000 (10s)
final
- maxDelay → int
-
The maximum delay to wait before reconnecting. If the calculated delay
is greater than this value, this value will simply be used instead.
final
- multiplier → double
-
The base that the number of attempts (exponent) is raised to when
multiplying by the initial timeout based on initialDelay and
randomness.
final
- randomness → int
-
The upper-bound of the random number of milliseconds to add to
initialDelay when computing the amount of time to reconnect to the
socket server.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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