Reconnection strategy

This document outlines the VPN session reconnection logic and how to configure the SDK's reconnection behavior.

Session reconnection functionality is available for usage with new API method StartVpnSession/StartVpnSessionAsync which combines GetCredentialsRequest and StartVpnRequest steps. During this call, VPN settings are cached for later use during reconnection attempts. If session reconnection is initiated and cached VPN settings are not available, error code ReconnectionCredentialsNotCached will be sent by SDK. For more info see the Error processing article.

The session reconnection powered by SDK is disabled by default. Please make sure that reconnection handled by your application logic is disabled when SDK reconnection is enabled.

circle-exclamation

Session Reconnection Behavior

The SDK automatically handles VPN session reconnection in several supported scenarios.

Switching between networks

The SDK will automatically handle reconnection when user switches between networks without disconnection (error code PrimaryNetworkInterfaceChanged from StateChanged event). The SDK behavior on network switch will be: stop the tunnel with appropriate error code PrimaryNetworkInterfaceChanged and try to restore the connection with last used VPN settings.

Network connectivity disruptions

When a network interruption occurs while VPN connection is ON (NoInternetConnection error received), SDK will start monitoring connectivity and attempt to reconnect once network connectivity is restored.

Transport errors during connection

If a transport error occurs during connection, the SDK will attempt to reconnect automatically. However, there are some errors for which automatic reconnection will not occur:

OperationalError
Description

ConnectionCanceled

Connection has been cancelled by client application request.

StopVpnFailed

Error has occurred while stopping VPN connection.

DcnBlockedBw

The traffic limit is exceeded.

PlatformNotSupported

Selected VPN protocol is not supported for the current platform.

ReconnectionCredentialsNotCached

SDK does not have cached VPN settings required to perform a reconnection.

InvalidConfiguration InvalidFireshieldConfiguration

Configuration changes are required to resolve these errors.

Enabling Session Reconnection

To check if VPN session reconnection functionality is enabled, you can use the following method:

To enable/disable the automatic reconnection behavior, you can use the following method:

Last updated

Was this helpful?