MqttClient Publish a message when you are inside the InterceptingPublishAsync
result to an Error when the Client Publish a QoS 1
#1969
Labels
bug
Something isn't working
Note: I'm migrating from version
3.1.2
to4.3.3.952
Describe the bug
I have a device that is connecting to Mqtt,
The device is subscribing and publishing a message correctly.
But publishing a message from the server will be ignored if the PubAck is not sent.
Here is my setup,
I'm using the
InterceptingPublishAsync
event to intercept messages from the client.In one of the messages I received, I would like to send another publish on a specific topic.
Unfortunately, the pubAck will be sent after my event inside the
InterceptingPublishAsync
The Client will ignore the Message (The Device/Client is not using MQTTNET, but using a low-level library)
We can find the issue here:
MQTTnet/Source/MQTTnet/Server/Internal/MqttClient.cs
Line 218 in 7f5c437
Having another event after the end of a pubAck, will help handling the message.
OnCompletedPublishAsync
Description of the QoS 1 delivery protocol
· MUST assign an unused Packet Identifier each time it has a new Application Message to publish.
· MUST send a PUBLISH Packet containing this Packet Identifier with QoS=1, DUP=0.
· MUST treat the PUBLISH Packet as “unacknowledged” until it has received the corresponding PUBACK packet from the receiver. See Section 4.4 for a discussion of unacknowledged messages.
1 The receiver is not required to complete delivery of the Application Message before sending the PUBACK. When its original sender receives the PUBACK packet, ownership of the Application Message is transferred to the receiver
Which component is your bug related to?
To Reproduce
Steps to reproduce the behavior:
InterceptingPublishAsync
Expected behavior
The pubAck should be sent before I even handle the business logic of the event itself
Screenshots
MqttNet 3
MqttNet 4
Code example
The text was updated successfully, but these errors were encountered: