I have experienced an issue where my app delivers a message twice when the app has a disconnection/reconnection, even if I set the message QOS to 2.
I want to send a message every second and deliver all the messages even if the phone is disconnected for a while.
If I set cleanSession to True, it looks like the app cleans the queue and loses some messages.
If I set cleanSession to False, I got the issue.
I found that recoverSessionBy enqueues stored messages and can duplicate messages.
I think it should check if the mqueue already holds the same message when a stored message is appended.
Hello,
I have experienced an issue where my app delivers a message twice when the app has a disconnection/reconnection, even if I set the message QOS to 2. I want to send a message every second and deliver all the messages even if the phone is disconnected for a while.
If I set
cleanSession
to True, it looks like the app cleans the queue and loses some messages. If I setcleanSession
to False, I got the issue.I found that
recoverSessionBy
enqueues stored messages and can duplicate messages. I think it should check if themqueue
already holds the same message when a stored message is appended.https://github.com/emqx/CocoaMQTT/blob/ff7c07b8a212e2e724d93a91d165a899df546db0/Source/CocoaMQTTDeliver.swift#L78-L94
The way to reproduce the issue
cleanSession
= falseBehavior
Expected
Thank you!