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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- 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)