MQTT - Not able to receive Large Payload

I’m sending a json with a payload of about 5028 bytes from a frontend to the a certain topic.

The JSON has around 250 elements.

In the AWS MQTT TEST, I can see the I receive the payload in two messages when I subscribe to the corresponding topic.

But at the device end, it only consumes only one of the messages which has about 176 elements and the remaining elements are lost. The QoS is 1 from the device end.

Could you please help if there are any configurations that I need to set to download all of the elements?


Hello Surender,

What is the size of pNetworkBuffer which you pass in to MQTT_Init from core_mqtt.c?

Additionally, is the JSON which is received at the device end well-formed, or is it missing closing curly braces?

@johnrhen ,

To answer you questions, the json received is well formed.

I have the kept the #define MQTT_AGENT_NETWORK_BUFFER_SIZE ( 5400 )
It was earlier 5000. And it was crashing because the receieved payload was of size 5028.
I increased it to 5400 and it’ still losing some amount of JSON.

Q1. About MQTT_RECV_POLLING_TIMEOUT_MS ( 2000U )to larger value ?
I did try with increasing the value. But it made no difference.


Interesting. What version of the libraries are you using?

Additionally, could you post the MQTT logs which are generated when you try to receive the messages? You may need to modify the logging levels to LOG_INFO.