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

Aedes publishes with QoS 2 when the client is subscribed with QoS 1 #208

Closed
v-divya110 opened this issue Jul 17, 2018 · 4 comments
Closed

Comments

@v-divya110
Copy link

Consider a client A which is subscribed to a topic T at QoS 1, and let client B publish a message to topic T at QoS 2, Aedes publishes the message to client A with QoS 2.

Based on the MQTT spec:
The subscription QoS gives the maximum QoS level at which the Server can send Application Messages to the Client."

3.8.4 provides non-normative examples here: http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718063

If a subscribing Client has been granted maximum QoS 1 for a particular Topic Filter, then a QoS 0 Application Message matching the filter is delivered to the Client at QoS 0. This means that at most one copy of the message is received by the Client. On the other hand a QoS 2 Message published to the same topic is downgraded by the Server to QoS 1 for delivery to the Client, so that Client might receive duplicate copies of the Message.

If the subscribing Client has been granted maximum QoS 0, then an Application Message originally published as QoS 2 might get lost on the hop to the Client, but the Server should never send a duplicate of that Message. A QoS 1 Message published to the same topic might either get lost or duplicated on its transmission to that Client.

Non normative comment

Subscribing to a Topic Filter at QoS 2 is equivalent to saying "I would like to receive Messages matching this filter at the QoS with which they were published". This means a publisher is responsible for determining the maximum QoS a Message can be delivered at, but a subscriber is able to require that the Server downgrades the QoS to one more suitable for its usage

@mcollina
Copy link
Collaborator

This is a bug, as we are downgrading to QoS 0 effectively (see https://github.com/mcollina/aedes/blob/master/test/qos2.js#L180-L210). Would you like to send a PR?

@v-divya110
Copy link
Author

Yes but I am a bit tight on schedule. Will send a PR as soon as I'm free

@ostafen
Copy link

ostafen commented Aug 2, 2018

I have a similar problem. Messages delivered with QOS 2 are sent more than once, while QO1 behaves like QOS2

@GavinDmello
Copy link
Collaborator

This bug should be solved with #229.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants