MQTTnet
MQTTnet copied to clipboard
QoS between Server and ManagedMqttClient
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.
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 That's true.
@grammyleung Were you able to resolve this issue?
Hi, @jdmartinez and @SeppPenner , thank you guys, I will try first and reply here.
I assume this issue is fixed.