reopenWhen

fun reopenWhen(reopenWhen: suspend (Throwable, attempt: Long) -> Boolean?): WebSocketNetworkTransport.Builder

Configure the WebSocketNetworkTransport to reopen the websocket automatically when a network error happens

Parameters

reopenWhen

a function taking the error and attempt index (starting from zero) as parameters and returning 'true' to reopen automatically or 'false' to forward the error to all listening Flow. It is a suspending function, so it can be used to introduce delay before retry (e.g. backoff strategy).