maximum payload size 256 bytes!

I'm using this mqtt library to connect to AWS IoT. It works fine except that I need to add more fields to the mqtt message sent, but I noticed on the AWS side my messages were cut at 256 characters. Indeed the source code shows a buffer size of 256 and code doesn't seem to allow that to be configured.

So I'm wondering, since this limit is hardcoded in the cpp file, what is the conventional approach to get around this for mqtt on the arduino? Or perhaps there is a better library? Major hurdle to working with arduino is a good way to figure out what are the more robust and commonly used libs, so any pointers for that would be much appreciated.

The “conventional way” to deal with such problems is to edit the source code to suit your project.

But if you can convince whoever wrote the library to change it for you, great!

jremington:
The "conventional way" to deal with such problems is to edit the source code to suit your project.

and maybe rename it so you can keep the original as is, since a library can have more projects that depend on it.

Thanks guys good to know

The rather crude decision about buffer size is made in MqttClient.ccp thus:

#ifdef __AVR__
#define TX_PAYLOAD_BUFFER_SIZE 128
#else
#define TX_PAYLOAD_BUFFER_SIZE 256
#endif