TsgcWSPClient_MQTT › Properties › HeartBeat
Sends MQTT PINGREQ packets periodically to keep the session alive and to detect silent broker drops.
property HeartBeat: TsgcWSMQTTHeartBeat_Options read FHeartBeat write SetHeartBeat;
Enabled=True, Interval=300, Timeout=0
Heartbeat is enabled by default. When HeartBeat.Enabled is True, the client sends an MQTT PINGREQ every Interval seconds and expects a PINGRESP in return, which also populates the broker's Keep Alive timer negotiated in CONNECT. Timeout is the number of seconds the client waits for the PINGRESP before closing the connection; set it to 0 to disable the timeout check. The ping traffic is an MQTT packet (not a WebSocket ping frame), so it traverses any WebSocket or raw-TCP transport identically. The OnMQTTPing event fires when a PINGRESP is received.
MQTT.HeartBeat.Enabled := True;
MQTT.HeartBeat.Interval := 60;
MQTT.HeartBeat.Timeout := 30;