TsgcWSPClient_MQTT › Events › OnMQTTPubAck
Fires when a PUBACK is received for a QoS 1 publish (PUBLISH → PUBACK).
property OnMQTTPubAck: TsgcWSMQTTPubAckEvent;
// TsgcWSMQTTPubAckEvent = procedure(Connection: TsgcWSConnection; aPacketIdentifier: Word; ReasonCode: Integer; const ReasonName: String; PubAckProperties: TsgcWSMQTTPUBACKProperties) of object
—
QoS 1 delivery uses a two-packet handshake: the client sends PUBLISH and the broker replies with PUBACK, at which point the message is considered delivered at least once. This event confirms the PUBACK leg. Parameters:
For QoS 0 no acknowledgement is sent and this event never fires. For QoS 2 see OnMQTTPubRec / OnMQTTPubRel / OnMQTTPubComp.
procedure TForm1.MQTTPubAck(Connection: TsgcWSConnection;
aPacketIdentifier: Word; ReasonCode: Integer;
const ReasonName: String;
PubAckProperties: TsgcWSMQTTPUBACKProperties);
begin
Memo1.Lines.Add(Format('PUBACK id=%d code=%d (%s)',
[aPacketIdentifier, ReasonCode, ReasonName]));
end;