arduino-mqtt
arduino-mqtt copied to clipboard
Document binary payloads
I think this library allows for binary payloads, but it isn't clear from the documentation.
How about updating the README.md
and the function prototypes to make it more obvious that fixed-length binary as well as null-terminated char strings are supported? eg,
Publishes a message to the broker with an optional payload, which can be a string or binary:
...
bool publish(const char topic[], const uint8_t payload[], int length);
bool publish(const char topic[], const uint8_t payload[], int length, bool retained, int qos);
Look at MQTTClient.cpp:146
str_payload = String((const char *)message.payload);
It doesn't look like that the library supports receiving binary.
The library supports registering an advanced callback using onMessageAdvanced
that will receive the full buffers. Check the readme to find more information.
The library supports registering an advanced callback using
onMessageAdvanced
that will receive the full buffers. Check the readme to find more information.
That doesn't address this issue, which is the documentation needs improving to mention fixed-length binary payloads, and how to use them in the library, onMessageAdvanced
doesn't currently mention binary payloads, or why you'd want to use it.
You're correct. Reopening.
I updated the Readme accordingly.