TsgcWebSocketServer | Server Keep Active

Once the server is started, sometimes it can stop for any reason. If you want to restart the server after an unexpected shutdown, you can use the WatchDog property.

 

WatchDog

If WatchDog is enabled, when the server detects a shutdown, WatchDog tries to restart every X seconds until the server is active again.

 

Example: restart every 10 seconds after an unexpected stop with unlimited attempts.

 


oServer := TsgcWebSocketServer.Create(nil);
oServer.WatchDog.Interval := 10;
oServer.WatchDog.Attempts := 0;
oServer.WatchDog.Enabled := true;
oServer.Active := true;