TsgcWSPClient_MQTT › Events › OnMQTTUnSubscribe
Fires when an UNSUBACK is received in response to UnSubscribe; exposes per-topic reason codes and MQTT 5 UnsubscribeProperties.
property OnMQTTUnSubscribe: TsgcWSMQTTUnSubscribeEvent;
// TsgcWSMQTTUnSubscribeEvent = procedure(Connection: TsgcWSConnection; aPacketIdentifier: Word; aCodes: TsgcWSUNSUBACKS; UnsubscribeProperties: TsgcWSMQTTUNSUBACKProperties) of object
—
Raised when the broker replies with an UNSUBACK to an UNSUBSCRIBE request. In MQTT 3.1.1 UNSUBACK carries no status; in MQTT 5.0 it carries one reason code per topic filter so the server can report "no subscription existed" or "not authorized" per-topic. Parameters:
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;