TsgcWebSocketHTTPServer › Properties › HeartBeat
Sends periodic ping frames to keep idle client connections alive and detect dead peers.
public TsgcWSHeartBeat_Options HeartBeat { get; set; }
Enabled=False
When HeartBeat.Enabled is True the server sends a ping to every connected client every Interval seconds. Use Timeout to close peers that do not pong within the given number of seconds (0 disables the check). HeartBeatType selects the strategy: hbtAlways always pings on every interval, while hbtOnlyIfNoMsgRcvInterval pings only if no message has been received in the last interval (on iohDefault the ping is sent in the context of the connection thread instead of a sweeper thread). The OnBeforeHeartBeat event lets you replace the standard ping with a custom message.
oServer = new TsgcWebSocketHTTPServer();
oServer.HeartBeat.Interval = 30;
oServer.HeartBeat.Timeout = 0;
oServer.HeartBeat.Enabled = true;
oServer.Active = true;