TsgcWSPClient_MQTTEvents › OnMQTTPubAck

OnMQTTPubAck Event

Fires when a PUBACK is received for a QoS 1 publish (PUBLISH → PUBACK).

Syntax

property OnMQTTPubAck: TsgcWSMQTTPubAckEvent;
// TsgcWSMQTTPubAckEvent = procedure(Connection: TsgcWSConnection; aPacketIdentifier: Word; ReasonCode: Integer; const ReasonName: String; PubAckProperties: TsgcWSMQTTPUBACKProperties) of object

Default Value

Remarks

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.

Example

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;

Back to Events