TsgcWSPClient_MQTT事件 › OnMQTTPubComp

OnMQTTPubComp 事件

在 QoS 2 握手的第四个也是最后一个阶段,当收到 PUBCOMP 时触发此事件。

语法

property OnMQTTPubComp: TsgcWSMQTTPubCompEvent;
// TsgcWSMQTTPubCompEvent = procedure(Connection: TsgcWSConnection; aPacketIdentifier: Word; ReasonCode: Integer; const ReasonName: String; PubCompProperties: TsgcWSMQTTPUBCOMPProperties) of object

默认值

备注

当代理发送 PUBCOMP(QoS 2 握手的第四个也是最后一个数据包,即 PUBLISH → PUBREC → PUBREL → PUBCOMP)时触发。此时,精确一次的传递已完全完成,数据包标识符可以重新使用。参数:

这是需要监听的事件,用于确认 QoS 2 发布已端到端完整处理。

示例

procedure TForm1.MQTTPubComp(Connection: TsgcWSConnection;
  aPacketIdentifier: Word; ReasonCode: Integer;
  const ReasonName: String;
  PubCompProperties: TsgcWSMQTTPUBCOMPProperties);
begin
  // QoS 2 delivery is now complete
  Memo1.Lines.Add(Format('PUBCOMP id=%d delivered exactly-once',
    [aPacketIdentifier]));
end;

返回事件