tldr/pages/common/mosquitto_sub.md

17 lines
734 B
Markdown
Raw Normal View History

2019-02-14 21:37:17 +00:00
# mosquitto_sub
> A simple MQTT version 3.1.1 client that will subscribe to topics and print the messages that it receives.
2019-06-04 10:25:18 +01:00
> More information: <https://mosquitto.org/man/mosquitto_sub-1.html>.
2019-02-14 21:37:17 +00:00
- Subscribe to the topic `sensors/temperature` information with Quality of Service (`QoS`) set to 1. (The default hostname is `localhost` and port 1883):
2019-02-14 21:37:17 +00:00
`mosquitto_sub -t {{sensors/temperature}} -q {{1}}`
- Subscribe to all broker status messages publishing on `iot.eclipse.org` port 1885 and print published messages verbosely:
2019-02-14 21:37:17 +00:00
`mosquitto_sub -v -h "iot.eclipse.org" -p 1885 -t {{\$SYS/#}}`
- Subscribe to multiple topics matching a given pattern. (+ takes any metric name):
`mosquitto_sub -t {{sensors/machines/+/temperature/+}}`