Hi, how does one send a binary MQTT message, and process the reply? The current payload content field only appears to cater to JSON or textual payload messages. Most IoT devices still use proprietary binary payloads requiring decoding/encoding.
Ok, found it - a very well hidden feature, and no searches on this in the help or forum found the answer either. It is in the dropdown selection box below the message panel around mid-screen defaulting to ‘Text’. Selecting this reveals additional format options.
Hey @sensornex
You should be able to find all information about MQTT request interface over on our Docs site:
Thanks, but all that is in the content is " * Message type - You can define the message type as Text, JSON, Base64, or Hexadecimal for Postman to render it correctly.", and there are no examples of using the hexadecimal type, and searching for the keyword ‘MQTT binary’ didn’t take me there either.
Perhaps you could expand this content further so it’s clearer for this use case.
I’ll pass that feedback on to the team to see if they can expand on that part of the documentation.
@sensornex thanks for bringing this up. I did have one question about your use cases. Would hex or base64 encoding work for your use case or are you using another encoding that we don’t currently support?
Hi, good timing, as I was about to follow up on this thread this morning, as I cannot see how to correctly format the Postman ‘Hexadecimal’ MQTT payload type. I searched your forum for this, and the only slightly relevant article I could find was this one using Base64 encodings - https://blog.postman.com/sending-and-debugging-binary-data-in-postman-requests/ . For testing embedded IoT devices, I need to use binary Hexadecimal payloads, as this is also what the OEM’s spec data sheets show with examples of parsing and messaging to their devices. I don’t want to waste time guessing how to use Hexadecimal formatting for this in Postman with MQTT - you need to provide concrete examples for this use-case for Hexadecimal message tests, and Base64 (since there are no MQTT examples of that either).
For some perspective, attached is the Milesight UC300 4G IO Controller payload decoder spec screenshot
, which shows how OEM’s typically give examples of binary protocol parsing and hexadecimal byte type operations. The device expects a binary MQTT sommand structure to be published to it, to respond.
Thank you for the example! On our end in the documentation we can look into showing example hex payloads.
For context you should be able to send a payload with the hex set to how it is shown in the spec. Postman currently doesn’t support any custom decoding but will send the message as a binary payload that your device should be able to decode. Let us know if this isn’t the case.
Hi, no matter what format I enter into the Postman message panel when Hexadecimal is selected, it does not actually publish a binary payload to the broker. For example, entering “7E010B003132333435367E” results in teh following on the wire…
… and variants of this such as “\x7E\x01\x0B\x00\x31\x32\x33\x34\x35\x36\x7E” or “0x7E 0x01 0x0B 0x00 0x31 0x32 0x33 0x34 0x35 0x36 0x7E” also do not result in a binary payload publish. It appears to be publishing the ASCII equivalent.
Here’s what an actual device’s binary payload published looks like…
I really need you to test this yourselves and advise what the format for the binary hex message that should be applied in the message panel is please.
Thanks for sharing what you’re receiving. This is a bug and we’re working on a fix for this and will let you know once we release it.