TsgcWSPClient_MQTTOlaylar › OnMQTTSubscribe

OnMQTTSubscribe Olay

Subscribe'a yanıt olarak bir SUBACK alındığında tetiklenir; konu başına neden kodlarını ve MQTT 5 SubscribeProperties'i gösterir.

Sözdizimi

property OnMQTTSubscribe: TsgcWSMQTTSubscribeEvent;
// TsgcWSMQTTSubscribeEvent = procedure(Connection: TsgcWSConnection; aPacketIdentifier: Word; aCodes: TsgcWSSUBACKS; SubscribeProperties: TsgcWSMQTTSUBACKProperties) of object

Varsayılan Değer

Remarks

Broker, bir SUBSCRIBE isteğine bir SUBACK ile yanıt verdiğinde tetiklenir. Broker, istekteki tek tek konu filtrelerini kabul edebilir, kısmen kabul edebilir veya reddedebilir, bu nedenle olay filtre başına bir kod teslim eder. Parametreler:

Örnek

procedure TForm1.MQTTSubscribe(Connection: TsgcWSConnection;
  aPacketIdentifier: Word; aCodes: TsgcWSSUBACKS;
  SubscribeProperties: TsgcWSMQTTSUBACKProperties);
var
  i: Integer;
begin
  for i := 0 to Length(aCodes) - 1 do
    if aCodes[i] < $80 then
      Memo1.Lines.Add(Format('subscription %d accepted (QoS %d)',
        [i, aCodes[i]]))
    else
      Memo1.Lines.Add(Format('subscription %d rejected (code $%x)',
        [i, aCodes[i]]));
end;

Olaylara Dön