# Challenges with MQTT Subscription: Message Truncation and Missed Messages

**URL:** <https://community.sixfab.com/t/challenges-with-mqtt-subscription-message-truncation-and-missed-messages/2835>\
**Category:** Pico LTE\
**Created:** [November 22, 2023, 4:53pm UTC](https://community.sixfab.com/t/challenges-with-mqtt-subscription-message-truncation-and-missed-messages/2835 "2023-11-22T16:53:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nigel.f.francis](https://community.sixfab.com/user_avatar/community.sixfab.com/nigel.f.francis/32/1530_2.png) [@nigel.f.francis](https://community.sixfab.com/u/nigel.f.francis)\
**Post date:** [November 22, 2023, 4:53pm UTC](https://community.sixfab.com/t/challenges-with-mqtt-subscription-message-truncation-and-missed-messages/2835/1 "2023-11-22T16:53:31Z")

</div>

Hey everyone,

Has anyone encountered issues with MQTT subscription? I’ve been facing a couple of challenges:

1. **Message Truncation:** Within the `extract_messages()` function, I’ve noticed that some messages are getting truncated. They’re coming through incomplete, which is causing some trouble.
2. **Missed Messages:** Additionally, the subscription occasionally misses messages. It’s not capturing all or most of them, which can be quite frustrating.

I’m using GSM exclusively, and my setup involves running a tracker in a continuous `while True` loop. This loop prioritizes GNSS to obtain location data, then focuses on WWAN to publish this location. Finally, it checks the buffer for incoming messages. The subscription process occurs before this loop starts. Overall, this setup operates well, but there are instances where the buffer appears empty when it should contain messages, or it only contains one or two messages instead of more.

Any insights or suggestions would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![ensar](https://community.sixfab.com/user_avatar/community.sixfab.com/ensar/32/8_2.png) [@ensar](https://community.sixfab.com/u/ensar)\
**Post date:** [January 8, 2024, 12:52pm UTC](https://community.sixfab.com/t/challenges-with-mqtt-subscription-message-truncation-and-missed-messages/2835/2 "2024-01-08T12:52:24Z")

</div>

Hi @nigel.f.francis ,

The recently released MQTT Example tutorial may be helpful for you.

> **[MQTT Example](https://docs.sixfab.com/docs/pico-lte-mqtt-example)**
>
> This section will guide you step by step on how to utilize publish and subscribe functionalities from a Pico LTE device to communicate with an MQTT broker over a cellular connection. It focuses on the MQTT protocol, providing examples of publishing...
