Subscribe
The subscribe with a context subscribes the currently active context client to the given topics. By default, it doesn’t block the console like the Subscribe without a context does. To enable this behavior you can use the -s option.
client@host> subscribe
Alias: client@host> sub
Options
Option | Long Version | Explanation | Default |
---|---|---|---|
-oc | --outputToConsole | If this flag is set the output will be printed to the console. | false |
-s | --stay | The subscribe emulates the same behavior as the subscribe command in non-shell mode. NOTE: the subscriptions will be unsubscribed afterwards. To cancel the command press Enter. | false |
Subscribe Options
Option | Long Version | Explanation | Default |
---|---|---|---|
-t | --topic | The MQTT topic the client will subscribe to. | |
-q | --qos | Define the quality of service level. If only one QoS is specified it will be used for all topics. You can define a specific QoS level for every topic. The corresponding QoS levels will be matched in order to the given topics. | 0 |
--output-to-file | Append the received publish messages to a file. Creates the file if it does not exist. | ||
--base64 | Whether the received publish messages will be base64 encoded. | false | |
-J | --json-output | Print the received publishes in pretty JSON format. | false |
-T | --show-topics | Prepend the specific topic name to the received publish. | false |
--user-property | A user property of the subscribe message. |
Help Options
Option | Long Version | Explanation |
---|---|---|
-h | --help | Display help message for command. |
-V | --version | Display version information of the cli. |
Examples
Subscribe to test topic on default settings (output will be written to Logfile. See Logging):
mqtt> con -i myClient
myClient@localhost> sub -t test