Fix: handle MQTT message fragmentation

MQTT messages might arrive in parts if their payload is too big. for that
reason, we need to be prepared to re-assemble fragmented messages
on a topic before handing them over to the subscriber.
This commit is contained in:
benzman
2025-04-15 20:03:11 +02:00
committed by Thomas Basler
parent d4c29d708b
commit d039455b82
2 changed files with 29 additions and 2 deletions

View File

@@ -6,6 +6,8 @@
#include <Ticker.h>
#include <espMqttClient.h>
#include <mutex>
#include <map>
#include <vector>
class MqttSettingsClass {
public:
@@ -36,6 +38,7 @@ private:
MqttClient* _mqttClient = nullptr;
Ticker _mqttReconnectTimer;
std::map<String, std::vector<uint8_t>> _fragments;
MqttSubscribeParser _mqttSubscribeParser;
std::mutex _clientLock;
};