Skip to content
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

Subscribing to MqttServer.ClientAcknowledgedPublishPacketAsync results in two events for every published application message #1550

Closed
mark-trumed opened this issue Oct 26, 2022 · 4 comments · Fixed by #1551
Labels
bug Something isn't working

Comments

@mark-trumed
Copy link

mark-trumed commented Oct 26, 2022

Describe the bug

After creating an MqttServer instance, I add an event handler for ClientAcknowledgedPublishPacketAsync:
_mqttServer.ClientAcknowledgedPublishPacketAsync += OnClientAcknowledgedPublishPacketAsync;

Every time a message is published to a client and acknowledged by the client, the event handler function OnClientAcknowledgedPublishPacketAsync() is called twice.

Which component is your bug related to?

  • Server

To Reproduce

Using version 4.1.2.350 of MQTTnet.
See the description for steps to reproduce.

Expected behavior

When a client receives and acknowledges a message, the ClientAcknowledgedPublishPacketAsync event handler is only called once.

Screenshots

n/a

Additional context / logging

n/a

@mark-trumed mark-trumed added the bug Something isn't working label Oct 26, 2022
@chkr1011
Copy link
Collaborator

Do you probably publish as QoS 2? It seems that the server then fires the event for the PUBREC and PUBCOMP packets.

@mark-trumed
Copy link
Author

@chkr1011 Yes, messages were published as QoS 2.

@chkr1011
Copy link
Collaborator

Ok then I assume this is the issue. I will fix this so that the event only gets called after the PUBCOMP message is received because only this message clearly marks the successful end of the transfer process.

@mark-trumed
Copy link
Author

@chkr1011 Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants