MQTTnet icon indicating copy to clipboard operation
MQTTnet copied to clipboard

QoS between Server and ManagedMqttClient

Open grammy-work opened this issue 5 years ago • 3 comments

Describe the bug

Because of testing, I instantized 2 ManagedMqttClients with 1 MqttServer. Step 1, connect both clients to server; Step 2, client A subscribes a Topic; Step 3, client B publishes to that Topic with QoS = AtLeaseOnce(0x01) or ExactlyOnce(0x02) Result: (i) Server's MqttApplicationMessageReceivedEvent works bringing correct QoS value as a property of ApplicationMessage. (ii) client A's MqttApplicationMessageReceivedEvent (no matter UseApplicationMessageReceivedHandler method or ApplicationMessageReceivedHandler with HandlerDelegate) brings only AtMostOnce(0x00), which modifies the original QoS value.

Which project is your bug related to?

  • ManagedClient
  • Server (MQTTnet.Server.IMqttServer)

To Reproduce

Using this version of MQTTnet '...'. Revision: 073cd5243fbd6adbe961413db042739d5b272ed3 Author: Christian Kratky [email protected] Date: 10/3/2019 9:23:35 PM Message: Update docs. Add UnitTests.

/* omitted, if needed will add 2. Run this code '....'. 3. With these arguments '....'. 4. See error. */

Expected behavior

Client A gets the exact QoS given by Client B in ApplicationMessageReceived event.

grammy-work avatar Feb 03 '20 19:02 grammy-work

You have to subscribe also setting the maximum level of QoS you want to receive. The default is 0. That's why you always get QoS = 0.

jdmartinez avatar Feb 05 '20 09:02 jdmartinez

@jdmartinez That's true.

@grammyleung Were you able to resolve this issue?

SeppPenner avatar Feb 06 '20 10:02 SeppPenner

Hi, @jdmartinez and @SeppPenner , thank you guys, I will try first and reply here.

grammy-work avatar Feb 09 '20 21:02 grammy-work

I assume this issue is fixed.

chkr1011 avatar Nov 09 '22 20:11 chkr1011