【发布时间】:2016-03-25 00:40:10
【问题描述】:
我对 MQTT 协议很陌生,如果我的问题听起来很愚蠢,我很抱歉。我正在从设备发布图像,当我在 CLI 上订阅它时,我可以看到一些不是二进制格式的字符。所以我的问题是,当图像发布时,它是否默认转换为 ASCII 格式然后发送,还是以 ASCII 格式或其他格式接收?
我给出的发布命令是:
mosquitto_pub --cafile /home/pi/nirupama/rootCA.pem --cert /home/pi/nirupama/certificate.pem --key /home/pi/nirupama/private.pem -h xxxxxxxxxxxxxx.iot.us -west-2.amazonaws.com -p 8883 -q 1 -d -t $aws/things/raspberry-pi/shadow/update -i mqtt_test -f /media/webcam/picture.jpg
订阅命令是:
mosquitto_sub --cafile /home/pi/nirupama/rootCA.pem --cert /home/pi/nirupama/certificate.pem --key /home/pi/nirupama/private.pem -h xxxxxxxxxxxxxx.iot.us -west-2.amazonaws.com -p 8883 -q 1 -d -t $aws/things/raspberry-pi/shadow/update -i mqtt_test1
【问题讨论】:
-
更新您的问题,准确了解您如何发布和订阅您发送的消息。但 MQTT 有效负载始终只是原始字节数组