TsgcTCPClient › Properties › HeartBeat
Triggers a periodic application-level heartbeat to keep the connection alive and detect stalls.
property HeartBeat: TsgcWSHeartBeat_Options read GetHeartBeat write SetHeartBeat;
Enabled=False
When HeartBeat.Enabled is True, the client fires the OnBeforeHeartBeat event every Interval seconds so you can write an application-defined probe over the raw TCP session. Because the client does not speak the WebSocket protocol, it has no built-in ping frame to send; use the event handler to emit whatever keep-alive bytes your wire format expects. Timeout is the maximum seconds between the outgoing probe and a response before the connection is closed (0 disables the check), and HeartBeatType selects hbtAlways (fire every interval) or hbtOnlyIfNoMsgRcvInterval (only if no message was received during the last interval). This is unrelated to the OS-level TCPKeepAlive probes.
oTCP := TsgcTCPClient.Create(nil);
oTCP.HeartBeat.Interval := 30;
oTCP.HeartBeat.Timeout := 0;
oTCP.HeartBeat.Enabled := true;
oTCP.Active := true;