256dpi / arduino-mqtt

MQTT library for Arduino
MIT License
1.01k stars 232 forks source link

Unable to publish very large payloads (e.g. images) #249

Closed plcengineer closed 1 year ago

plcengineer commented 3 years ago

In preparation of data transmitting, the client copies the given payload into an internal buffer. This action causes the usage of huge memory and data redundancy. In my case, I would send an PNG image recorded with the ESP32-Cam Module. So the payload comes from the camera memory as pointer and without the need of copying the whole frame buffer.

plcengineer commented 3 years ago

In preparation of data transmitting, the client copies the given payload into an internal buffer. This action causes the usage of huge memory and data redundancy. In my case, I would send an PNG image recorded with the ESP32-Cam Module. So the payload comes from the camera memory as pointer and without the need of copying the whole frame buffer.

--> Made a possible solution in my fork of this very good library: see last commits: https://github.com/plcengineer/arduino-mqtt

256dpi commented 3 years ago

Yes this would be nice to get fixed. Possibly we could do this together with #145. In any case this should be first implemented in lwmqtt.

plcengineer commented 3 years ago

That would be great. I could add some sort of solution for reading too. But I would need a bit more time. Until now, I looked for an hour in your code.. Maybe next week I can dive a bit deeper.

256dpi commented 1 year ago

With the latest update of lwmqtt, message payloads are now sent directly and not written to the write buffer anymore. Therefore, very large payloads are possible now. The feature is planned to be available with the next release (2.6).