Package-level declarations

Types

Link copied to clipboard
class ExponentialBackOff(initialDelay: Duration = 1.seconds, factor: Double = 2.0) : RetryDelayStrategy

A RetryDelayStrategy where the delay is multiplied by a constant factor after each attempt.

Link copied to clipboard

A RetryDelayStrategy where the delay is the same for all attempts.

Link copied to clipboard
data class ReconnectConfig(val maxAttempts: Int = DEFAULT_MAX_ATTEMPTS, val delayStrategy: RetryDelayStrategy = DEFAULT_DELAY_STRATEGY, val reconnectContext: CoroutineContext = EmptyCoroutineContext, val shouldReconnect: suspend (exception: Throwable, attempt: Int) -> Boolean = { _, _ -> true }, val afterReconnect: suspend (WebSocketConnection) -> Unit = {})

Configuration for web socket reconnections.

Link copied to clipboard
Link copied to clipboard

Defines the time to wait before each attempt in a retry mechanism.

Link copied to clipboard
class WebSocketReconnectionException(val url: String, val nAttemptedReconnections: Int, val cause: Throwable, message: String = "Could not reconnect to web socket at $url after $nAttemptedReconnections attempts. Giving up. " + "The exception during the last attempt was $cause") : WebSocketConnectionException

Functions

Link copied to clipboard
Link copied to clipboard
fun WebSocketClient.withAutoReconnect(maxAttempts: Int = DEFAULT_MAX_ATTEMPTS, delayStrategy: RetryDelayStrategy = DEFAULT_DELAY_STRATEGY): WebSocketClient

Returns a new WebSocketClient that automatically reconnects on web socket errors using this client.