mosquitto_pub 二进制文件发送
将二进制数据放入文件中,然后将其作为消息发送:
mosquitto_pub -t test -f file
使用test.mosquitto.org测试数据发送
mosquitto_pub -L mqtt://test.mosquitto.org:1883/LSTS/debug -f doc/buf.bin -d
Client mosq-ZRfknutaDJCvdaPpYI sending CONNECT
Client mosq-ZRfknutaDJCvdaPpYI received CONNACK (0)
Client mosq-ZRfknutaDJCvdaPpYI sending PUBLISH (d0, q0, r0, m1, 'LSTS/debug', ... (35 bytes))
Client mosq-ZRfknutaDJCvdaPpYI sending DISCONNECT
订阅消息
mosquitto_sub -L mqtt://test.mosquitto.org:1883/LSTS/debug -d
Client mosq-Jrrv1j2it7SnqvdTVa sending CONNECT
Client mosq-Jrrv1j2it7SnqvdTVa received CONNACK (0)
Client mosq-Jrrv1j2it7SnqvdTVa sending SUBSCRIBE (Mid: 1, Topic: LSTS/debug, QoS: 0, Options: 0x00)
Client mosq-Jrrv1j2it7SnqvdTVa received SUBACK
Subscribed (mid: 1): 0
Client mosq-Jrrv1j2it7SnqvdTVa received PUBLISH (d0, q0, r0, m0, 'LSTS/debug', ... (35 bytes))