TsgcWSPClient_MQTTEventi › OnMQTTUnSubscribe

OnMQTTUnSubscribe Evento

Viene generato quando viene ricevuto un UNSUBACK in risposta a UnSubscribe; espone i codici di motivo per topic e le UnsubscribeProperties di MQTT 5.

Sintassi

property OnMQTTUnSubscribe: TsgcWSMQTTUnSubscribeEvent;
// TsgcWSMQTTUnSubscribeEvent = procedure(Connection: TsgcWSConnection; aPacketIdentifier: Word; aCodes: TsgcWSUNSUBACKS; UnsubscribeProperties: TsgcWSMQTTUNSUBACKProperties) of object

Valore predefinito

Note

Attivato quando il broker risponde con un UNSUBACK a una richiesta UNSUBSCRIBE. In MQTT 3.1.1 UNSUBACK non contiene uno stato; in MQTT 5.0 contiene un codice motivo per ogni filtro di argomento, in modo che il server possa segnalare "nessuna sottoscrizione esistente" o "non autorizzato" per singolo argomento. Parametri:

Esempio

procedure TForm1.MQTTUnSubscribe(Connection: TsgcWSConnection;
  aPacketIdentifier: Word; aCodes: TsgcWSUNSUBACKS;
  UnsubscribeProperties: TsgcWSMQTTUNSUBACKProperties);
var
  i: Integer;
begin
  for i := 0 to Length(aCodes) - 1 do
    Memo1.Lines.Add(Format('unsubscribe %d result=$%x',
      [i, aCodes[i]]));
end;

Torna agli Eventi