TsgcWSPClient_MQTT › Events › OnMQTTPublish
Broker gelen bir PUBLISH mesajı teslim ettiğinde tetiklenir; Topic, Text ve MQTT 5 PublishProperties'i ortaya çıkarır.
property OnMQTTPublish: TsgcWSMQTTPublishEvent;
// TsgcWSMQTTPublishEvent = procedure(Connection: TsgcWSConnection; aTopic, aText: String; PublishProperties: TsgcWSMQTTPUBLISHProperties) of object
—
Ana teslim olayı: broker, aboneliklerinden biriyle eşleşen bir konu için bu istemciye bir PUBLISH ilettiğinde her seferinde tetiklenir. Yayın QoS'undan (0, 1 veya 2) bağımsız olarak olay, aktarım düzeyi onay sırası tamamlandıktan sonra tetiklenir: QoS 0 gönder-ve-unut, QoS 1 PUBACK'ten sonra, QoS 2 PUBREC/PUBREL/PUBCOMP takasından sonra. Parametreler:
procedure TForm1.MQTTPublish(Connection: TsgcWSConnection;
aTopic, aText: String;
PublishProperties: TsgcWSMQTTPUBLISHProperties);
begin
Memo1.Lines.Add(Format('[%s] %s', [aTopic, aText]));
// MQTT 5: honour a ResponseTopic if the sender set one
if PublishProperties.ResponseTopic <> '' then
MQTT.Publish(PublishProperties.ResponseTopic, 'ack', mtqsAtMostOnce);
end;