MQTT-TLS client publish data maximum size

Hi y’all,
I’m using MQTT-TLS 0.2.23 to send data via MQTT to my company’s broker. I’m able to send data using the JSONWriter class, but only up to a certain string size - meaning, the length of the ‘data’ argument on the client.publish() function.

Is there any way to increase the size of the data to be sent to the cloud?

This is a successful message going to my broker. I can display the value of the tags in my available widgets:
{“data”: {“level”:468,“temperature2”:144488.17,“device”:“xxx2022”,“str_per”:57.499,“str_val”:-92,“qualVal”:-14,“qualPer”:33.3333,“ai00test”:156,“ai00lowLevelAlm”:1,“ai00inc”:1}, “timestamp”:1644619800000}

This is a message I cannot see on my cloud widgets. The objects are the same, the only thing that changed is the value of the ‘device’ object in the JSON:
{“data”: {“level”:468,“temperature2”:210048.70,“device”:“This is the first unit in the xxxxxxxx test to be tested from the xxxxxxxx office”,“str_per”:57.499,“str_val”:-92,“qualVal”:-12,“qualPer”:41.6663,“ai00test”:141,“ai00lowLevelAlm”:1,“ai00inc”:0}, “timestamp”:1644621303000}

Any light shed will be very appreciated!

thanks,

-R

Hi @romuloescamilla ,
Try to update MQTT_MAX_PACKET_SIZE value in MQTT-TLS.h.
(default is MQTT_MAX_PACKET_SIZE 255)
Thank you.

1 Like

thanks for the quick reply! sorry about this, but I’m no expert on the IDE. How can I modify the value? I opened the file but it doesn’t let me modify it. Can you please explain the procedure?

@romuloescamilla Okay, then you could update MAX_PACKET_SIZE(255) value at the initialize MQTT class with 4th parameter. like this.
MQTT client(“something server”, 8883, callback, 512);
You could find the maxpacketsize parameter in MQTT-TLS.h .

Awesome, it works, thanks so much hirotakaster!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.