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.
Hi, has this issue been resolved/fixed in a new release yet?
Hi Andrew, if you update postman to the latest version you should be able to send binary strings using either base64 or hex encoding.
Thanks - I just upgraded and tested this, and the issue appears to be corrected now. Have you updated the guidance docâs on this as well?
@sensornex we have made updates to try and make it more clear to use one of the binary encodings when trying to send binary payloads.
Hi, thereâs still no guidance on this in the very help section it should be in (IMHO) - Using the MQTT request interface | Postman Docs
Weâll raise a separate documentatuon specific ticket to capture this @sensornex
Thanks. Iâll mark this âSolutionâ as âresolvedâ when that is available with the link.
Weâve updated the documentation in the MQTT request interface section to mention an example of when youâd use a binary payload for a messaging type (and also where specifically the Message type option is):
Message type - Select the dropdown menu to set the message type as Text, JSON, Base64, or Hexadecimal. This defaults to Text. For example, to send a binary payload, youâd select the Base64 or Hexadecimal message type.
Thanks, but I think youâve missed the point again - anyone wanting to test IoT type devices that use binary message payloads will still need to try and figure out how to use Postmanâs MQTT features to create a test harness to do this. Your examples take the easy route once again and refer to JSON payloads. What you need to add is some full âbinary onlyâ (Hex) test creation examples. Without this, anyone working with low-level HW using MQTT will be disappointed with their Postman experience trying to get it working for their project.