ReconnectConfig

data class ReconnectConfig(    val maxAttempts: Int = DEFAULT_MAX_ATTEMPTS,     val delayStrategy: RetryDelayStrategy = DEFAULT_DELAY_STRATEGY,     val shouldReconnect: suspend (exception: Exception, attempt: Int) -> Boolean = { _, _ -> true },     val afterReconnect: suspend (WebSocketConnection) -> Unit = {})

Configuration for web socket reconnections.

Constructors

Link copied to clipboard
fun ReconnectConfig(    maxAttempts: Int = DEFAULT_MAX_ATTEMPTS,     delayStrategy: RetryDelayStrategy = DEFAULT_DELAY_STRATEGY,     shouldReconnect: suspend (exception: Exception, attempt: Int) -> Boolean = { _, _ -> true },     afterReconnect: suspend (WebSocketConnection) -> Unit = {})

Properties

Link copied to clipboard
val afterReconnect: suspend (WebSocketConnection) -> Unit

A callback called each time the web socket is successfully reconnected.

Link copied to clipboard
val delayStrategy: RetryDelayStrategy

Defines the time to wait before each reconnection attempt.

Link copied to clipboard
val maxAttempts: Int

The maximum number of reconnection attempts before giving up.

Link copied to clipboard
val shouldReconnect: suspend (exception: Exception, attempt: Int) -> Boolean

A predicate to decide whether the web socket should be reconnected when the given exception occur. The attempt parameter is the index of the current reconnection attempt in a series of retries.

Sources

Link copied to clipboard