Topic: MQTT QoS 1 Message Duplication After Reconnect

Hi everyone,

I'm testing wolfMQTT on an embedded device that uses a cellular connection. When the network drops briefly and the client reconnects, I occasionally receive duplicate MQTT messages that were originally published with QoS 1.

My application stores packet IDs and acknowledges messages correctly, but duplicates still appear after reconnection in some cases.

Does wolfMQTT provide any built-in mechanism or recommended approach for tracking and filtering duplicate QoS 1 messages across reconnect events, especially when using persistent sessions (clean session disabled)?

If anyone has implemented this successfully on resource-constrained devices, I'd appreciate hearing about your experience.

Thanks!

Re: MQTT QoS 1 Message Duplication After Reconnect

Hi Logan,

Welcome to the wolfSSL Forums.

QoS1 messages may be duplicated, this is just part of the standard. If your application needs "once-and-only-once", QoS2 is what you're looking for.

It wasn't clear from your post which side your application is; are you using wolfMQTT as the client, broker. or both?

You should be able to discern if the message is a duplicate by checking the `msg->duplicate` field in the callback when a message is received.

Let us know if that helps.

Thanks,
Eric -wolfSSL Support