TsgcWebSocketClient › Properties › WatchDog
Automatically reconnects to the server after an unexpected disconnection.
property WatchDog: TsgcWSWatchDogClient_Options read FWatchDog write SetWatchDog;
Enabled=False, Interval=10, Attempts=0
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.
oClient := TsgcWebSocketClient.Create(nil);
oClient.WatchDog.Interval := 10;
oClient.WatchDog.Attempts := 0;
oClient.WatchDog.Enabled := true;
oClient.Active := true;