Skip to content

mqtt_unsubscribe

sanshengshui edited this page Oct 7, 2023 · 4 revisions

Unsubscribes the currently active context client from a list of topics and is therefore only available in Shell mode.

clientId@host:port > unsubscribe

Alias: client@host:port > unsub

Options

Option Long Version Explanation
-t --topic The topics to publish to

Example

Connect a client which is identified by test mosquitto client1 and subscribe it to two topics afterward. Then unsubscribe from one of the two topics:

Welcome to Toolkit v0.7.0 Press Ctrl+C or `exit` to exit the REPL used: 🔴 unused: 🟢 🟢 0: test mosquitto client1@test.mosquitto.org:1883 🟢 1: test mosquitto client2@test.mosquitto.org:1883 new > add a new config settings Please select your mqtt configs: > 0 you typed:0 clientId:toolkit_mqtt_foRbI6r1 connect broker test.mosquitto.org:1883??? Usage: > { pub | sub | unsub | dis | list | exit } In context mode all MQTT commands relate to the currently active client. commands: help Displays help information about the specified command pub, publish Publish a message to a list of topics sub, subscribe Subscribe this MQTT client to a list of topics unsub, unsubscribe Unsubscribe this MQTT client from a list of topics dis, disconnect Disconnects this MQTT client ls, list List connected client info and subscribed topics exit Exit the current context test mosquitto client1@test.mosquitto.org:1883 > sub -t topic1 test mosquitto client1@test.mosquitto.org:1883 > sub -t topic2 test mosquitto client1@test.mosquitto.org:1883 > list ClientId: Name: test mosquitto client1@test.mosquitto.org:1883 Client Id: toolkit_mqtt_foRbI6r1 Username: Password: Keep Alive : 10(s) Clean Session : Y Subscribed Topics: topic: topic1 qos: AT_MOST_ONCE topic: topic2 qos: AT_MOST_ONCE test mosquitto client1@test.mosquitto.org:1883 > unsub -t topic1 test mosquitto client1@test.mosquitto.org:1883 > 

toolkit-config


toolkit-MQTT

  • toolkit mqtt desc: introduction and description of MQTT protocol;
  • toolkit mqtt set: mqtt settings information management;
  • toolkit mqtt shell: mqtt shell mode;

toolkit-CoAP

Synopsis:

  • toolkit coap desc: introduction and description of CoAP protocol;

  • toolkit coap mt: List supported MIME types;

  • toolkit coap disc: list available resources;

  • toolkit coap get: Request data from CoAP Resource;

  • toolkit coap post: Create/Update data in CoAP Resource;

  • toolkit coap put: Update data in CoAP Resource;

  • toolkit coap del: Delete CoAP Resource;


toolkit-NBIOT

NB-IoT


Test

Clone this wiki locally