# MQTT - Not able to receive Large Payload

**URL:** <https://forums.freertos.org/t/mqtt-not-able-to-receive-large-payload/14987>\
**Category:** AWS\
**Tags:** aws-iot-core\
**Created:** [May 3, 2022, 3:07pm UTC](https://forums.freertos.org/t/mqtt-not-able-to-receive-large-payload/14987 "2022-05-03T15:07:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Surender](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@Surender](https://forums.freertos.org/u/Surender)\
**Post date:** [May 3, 2022, 3:07pm UTC](https://forums.freertos.org/t/mqtt-not-able-to-receive-large-payload/14987/1 "2022-05-03T15:07:24Z")

</div>

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?

Regards,  
Surender

---

<div class="post-metadata">

**Author:** ![johnrhen](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/johnrhen/32/2089_2.png) [@johnrhen](https://forums.freertos.org/u/johnrhen)\
**Post date:** [May 3, 2022, 7:57pm UTC](https://forums.freertos.org/t/mqtt-not-able-to-receive-large-payload/14987/2 "2022-05-03T19:57:11Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Surender](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@Surender](https://forums.freertos.org/u/Surender)\
**Post date:** [May 4, 2022, 8:55am UTC](https://forums.freertos.org/t/mqtt-not-able-to-receive-large-payload/14987/3 "2022-05-04T08:55:22Z")

</div>

@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.

Regards,  
Surender

---

<div class="post-metadata">

**Author:** ![johnrhen](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/johnrhen/32/2089_2.png) [@johnrhen](https://forums.freertos.org/u/johnrhen)\
**Post date:** [May 6, 2022, 7:55pm UTC](https://forums.freertos.org/t/mqtt-not-able-to-receive-large-payload/14987/4 "2022-05-06T19:55:03Z")

</div>

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.
