Hi,
the mosquitto MQTT broker also consists of some command line tools to publish or subscribe topics from a shell.
Pubishing a topic by using mosquitto_pub
1 | mosquitto_pub --topic myRootTopic /subTopic/Value -u mqttiuser -P 'mqtt_password' -h 10.10.254.10 -p 1883 -m "0" |
and with the retain flag set
1 | mosquitto_pub --topic myRootTopic /subTopic/Value --retain -u mqttiuser -P 'mqtt_password' -h 10.10.254.10 -p 1883 -m "0" |
Subscribing a topic is straightforward with the same options as mosquitto_pub expect -m. This starts mosquitto_sub in an loop. Multiple –topic options are possible
1 | mosquitto_sub --topic myRootTopic /subTopic/Value -u mqttiuser -P 'mqtt_password' -h 10.10.254.10 -p 1883 |
Michael