webSocketReopenWhen

var webSocketReopenWhen: suspend (Throwable, attempt: Long) -> Boolean?


Deprecated

Use subscriptionNetworkTransport() directly. See https://go.apollo.dev/ak-v5-websockets for more details.

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

Parameters

webSocketReopenWhen

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). attempt is reset after a successful connection.

This is a convenience function that configures the underlying WebSocketNetworkTransport. See also subscriptionNetworkTransport for more customization.

See also