-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Topic Aliases - Failures after connection loss #276
Comments
My previous comment includes two issues:
For issue 1, I submit a separate PR(#277) with sample code. For issue 2, as you mentioned, since OnPublish is called right before publishing, it doesn’t cause an issue. I wrote sample code to verify this, and the problem did not occur. It seems that another part of my code was likely causing the issue. I will retract the issue. |
Thanks for the PR @shirou. Then add another callback just before the message is sent. This would check if they are both set and: If both set then lookup the alias ID in the map:
This way the aliases could work accross reconnections (either clear the map, or add a flag indicating that the broker needs to be send both parts the next time a message is sent). This would require a callback immediatly before a publish packet is sent (or resent) but should be fairly simple to implement. The user could use something like the existing |
Describe the bug
As per the MQTT spec:
Currently this library stores QOS1+ packets that contain the alias. This is a problem because the conneciton may be dropped/re-established before the messages are sent (meaning the topic alias is either invalid, or worse, wrong).
Comments in this issue indicate that this may also be an issue in the autopaho queue, but I cannot see a problem there (of course if the user is setting the alias when creating the message that will cause issues).
I think the messages stored need to be the full messages, this means moving
PublishHook
so it's called immediatly before the message is transmitted (and noting that it may be called more than once if a message needs to be retransmitted).To reproduce
Send loads of QOS2 messages with
TAHandler
enabled, drop and reestablish connection whilst transmission is in progress..Expected behaviour
TAHandler
should work accross reconnects.Software used:
v0.22
The text was updated successfully, but these errors were encountered: