1

I am quite new to MQTT protocol and I am sorry if my question sounds stupid. I am publishing an image from a device and when I subscribe to it on CLI I can see some characters which are not in the binary format. So my question is when the image is published does it by default get converted to ASCII format and then sent or is it received in the ASCII format or some other format?

The publish command I am giving is:

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

The subscribe command is:

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

1
  • Update your question with exactly how you are publishing and subscribing to the messages you are sending. But MQTT payloads are always just raw byte arrays
    – hardillb
    Mar 24, 2016 at 6:54

1 Answer 1

5

This question was answered on the MQTT mailing list by JP Mens: https://groups.google.com/forum/#!topic/mqtt/MIwf0-Bi9yM

The answer is that MQTT in a binary protocol and they payloads are not converted to ASCII or any other text format. You should indeed be able to send binary image payloads without corruption.

1
  • Got what I wanted to know. Thank you! Mar 24, 2016 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.