objectif
Vérifier la connectivité et le flux de messages MQTT.
code minimal
# terminal 1
mosquitto_sub -h broker.data.pm -t 'test/#' -v
# terminal 2
mosquitto_pub -h broker.data.pm -t 'test/hello' -m 'world'
utilisation
# avec auth TLS
mosquitto_pub -h broker.data.pm -p 8883 --cafile ca.pem --cert client.crt --key client.key -t 'secure/topic' -m 'ok'
variante(s) utile(s)
# QoS 1
mosquitto_pub -q 1 -t 'test/qos1' -m 'msg'
notes
- installez mosquitto-clients.
- adaptez la QoS selon besoin (0/1/2).