TsgcWebSocketClientProperties › WatchDog

WatchDog Property

Automatically reconnects to the server after an unexpected disconnection.

Syntax

public TsgcWSWatchDogClient_Options WatchDog { get; set; }

Default Value

Enabled=False, Interval=10, Attempts=0

Remarks

When WatchDog.Enabled is True, the client detects a dropped connection and tries to reconnect every Interval seconds. Attempts controls the maximum number of reconnect attempts; zero means unlimited retries. Use the OnBeforeWatchDog event to customise the reconnection flow, for example to fall back to a secondary server or cancel the retry by setting Handled to True.

Example


oClient = new TsgcWebSocketClient();
oClient.WatchDog.Interval = 10;
oClient.WatchDog.Attempts = 0;
oClient.WatchDog.Enabled = true;
oClient.Active = true;

Back to Properties