I would like to publish 100 uint16_t values at once. I would like to publish them as binary value since then they fit into the 255 bytes of the data field:
optional data (up to 255 bytes)
Unfortunately the Particle.publish(const char *eventName, const char *data) only takes an ´const char *´ and no length and uses internally strlen() to calculate the length of the data which prevents sending binary data.
So the only way I found is encoding the binary data with a Base64 so I can send it as a string, but Base64 adds 33% overhead and with this my 100 uint16_t do not fit one publish anymore.
Is there another way to publish binary data without the overhead of an encoding?
You can also use Base85 but raw binary data can’t be transported via the cloud functions.
But TCP/UDP transport can send (unencrypted) binary data, but then you can also ignore the 255 byte limit.
Particle.variable() strings can only be requested not pushed, but a string variable can be as long as 622 characters.
I will probably go with Base85 with the 25% overhead my 100 uint16_t values fit into the 255 bytes limit.
Raw TCP/UDP transport is no option since I have no server side that supports it.
The variable is no option since I need to push them from the device since the device will be most of the time offline to save power.