unsubscribe
Description
unsubscribe( unsubscribes the MQTT
client from all its subscribed topics.mqttClient)
unsubscribe(
unsubscribes the MQTT client from the topic specified in
mqttClient,Topic=mqttTopic)mqttTopic.
Examples
View the subscriptions of a client.
mqttClient.Subscriptions
ans =
3×3 table
Topic QualityOfService Callback
_________________ ________________ _____________
"trubits/mqTop48" 0 ""
"trubits/mqTmp52" 2 ""
"trubits/mqTsp61" 0 "showmessage"Unsubscribe from one topic.
unsubscribe(mqttClient,Topic="trubits/mqTsp61")
mqttClient.Subscriptionsans =
2×3 table
Topic QualityOfService Callback
_________________ ________________ ________
"trubits/mqTop48" 0 ""
"trubits/mqTmp52" 2 ""Unsubscribe from all remaining topics.
unsubscribe(mqttClient) mqttClient.Subscriptions
ans = 0×3 empty table
View the subscriptions of a client.
mqttClient.Subscriptions
ans =
5×3 table
Topic QualityOfService Callback
_________________ ________________ _____________
"MATLAB/104/mqTop48" 0 ""
"MATLAB/105/mqTop48" 0 ""
"MATLAB/105/mqTmp52" 0 ""
"MATLAB/105/mqTsp61" 0 ""
"MATLAB/106/mqTrp74" 0 "" Unsubscribe using a single-level wildcard.
unsubscribe(mqttClient,Topic="MATLAB/+/mqTop48")
mqttClient.Subscriptionsans =
3×3 table
Topic QualityOfService Callback
_________________ ________________ ________
"MATLAB/105/mqTmp52" 0 ""
"MATLAB/105/mqTsp61" 0 ""
"MATLAB/106/mqTrp74" 0 "" Unsubscribe using a multi-level wildcard.
unsubscribe(mqttClient,Topic="MATLAB/#")
mqttClient.Subscriptionsans = 0×3 empty table
Input Arguments
MQTT client, specified as an icomm.mqtt.Client object. Create the
client using the mqttclient
function.
Example: mqttClient = mqttclient()
Data Types: object
MQTT topic to unsubscribe from, specified as a string or character vector. Specify a wildcard topic to unsubscribe from all topics under a certain hierarchy.
Example: "trubits/mqTop48"
Data Types: string | char
Version History
Introduced in R2022aUse the unsubscribe function with a wildcard topic to unsubscribe
from all topics under a certain hierarchy.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)