withAutoReconnect

fun WebSocketClient.withAutoReconnect(maxAttempts: Int = DEFAULT_MAX_ATTEMPTS, delayStrategy: RetryDelayStrategy = DEFAULT_DELAY_STRATEGY): WebSocketClient(source)

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

The WebSocketConnection returned by connect is an abstraction over this client's connections, so that the same connection instance can be used across reconnections, which happen transparently under the hood.

When chaining multiple withAutoReconnect calls, the last reconnect configuration takes precedence.

Note: limitations on Kotlin/Native multithreaded coroutines prevent the reconnection wrapper from working properly. Please use the new memory model if you want the reconnection feature on Kotlin/Native.