TsgcWSPClient_MQTTEvents › OnMQTTPubRel

OnMQTTPubRel Event

Fires on the third leg of the QoS 2 handshake when a PUBREL is received.

Syntax

property OnMQTTPubRel: TsgcWSMQTTPubRelEvent;
// TsgcWSMQTTPubRelEvent = procedure(Connection: TsgcWSConnection; aPacketIdentifier: Word; ReasonCode: Integer; const ReasonName: String; PubRelProperties: TsgcWSMQTTPUBRELProperties) of object

Default Value

Remarks

Third leg of the QoS 2 exchange (PUBLISH → PUBREC → PUBREL → PUBCOMP). This event fires when a PUBREL packet is received from the broker as part of the exactly-once flow for a message the broker is delivering to this client. The component automatically responds with PUBCOMP to close the handshake. Parameters:

Use this event mainly for logging / diagnostics; no application action is required.

Example

procedure TForm1.MQTTPubRel(Connection: TsgcWSConnection;
  aPacketIdentifier: Word; ReasonCode: Integer;
  const ReasonName: String;
  PubRelProperties: TsgcWSMQTTPUBRELProperties);
begin
  Memo1.Lines.Add(Format('PUBREL id=%d code=%d',
    [aPacketIdentifier, ReasonCode]));
end;

Back to Events