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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- 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)