TsgcWSPClient_MQTT › Eventos › OnMQTTPing
Se activa cuando el cliente recibe un PINGRESP que confirma un PINGREQ enviado previamente.
property OnMQTTPing: TsgcWSMQTTPingEvent;
// TsgcWSMQTTPingEvent = procedure(Connection: TsgcWSConnection) of object
—
Confirma que el broker respondió con PINGRESP a un PINGREQ. El cliente envía PINGREQ automáticamente cuando HeartBeat está habilitado (el valor predeterminado) en el Interval configurado; si HeartBeat está deshabilitado, puede llamar al método Ping manualmente y seguir recibiendo este evento en la respuesta. Úselo para mostrar la actividad de keep-alive en registros o en la interfaz de usuario. Si HeartBeat.Timeout transcurre sin un PINGRESP, la conexión se cierra automáticamente y se activa OnMQTTDisconnect en su lugar.
procedure TForm1.MQTTPing(Connection: TsgcWSConnection);
begin
Memo1.Lines.Add(Format('[%s] PINGRESP from broker',
[FormatDateTime('hh:nn:ss', Now)]));
end;