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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)