Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

forwardRetained for qos=1 subscriptions #540

Open
behrad opened this issue Sep 10, 2016 · 4 comments
Open

forwardRetained for qos=1 subscriptions #540

behrad opened this issue Sep 10, 2016 · 4 comments
Labels

Comments

@behrad
Copy link
Contributor

behrad commented Sep 10, 2016

If a client is subscribing a qos=1 topic, but not issuing the subscribe command on each reconnect, retained messages are not forwarded, however I think they should!

This is since forwardRetained is called inside handleSubscribe https://github.com/mcollina/mosca/blob/master/lib/client.js#L496, but should be moved inside restoreClientSubscriptions or authorizeSubscribe so that it gets called on each subscription restore.

@mcollina
Copy link
Collaborator

mcollina commented Sep 10, 2016

I do not think retained messages should be forwarded in this case.
Have you tried this with mosquitto or another MQTT broker and checked if they behave like Mosca?

  1. client A has a QoS 1 subscription
  2. client A goes offline
  3. client B publishes a retained message with QoS 0
  4. client A should or should not receive the retained message

I think it should not. If this is still unclear from the spec, we might ask it to be clarified/fixed.

@behrad
Copy link
Contributor Author

behrad commented Sep 10, 2016

This topic is about the following scenario:

  1. client A has a QoS 1 subscription
  2. client A goes offline
  3. client B publishes a retained message with QoS 1
  4. client A connects (without sending a subcribe)
  5. client A should receive the retained message

here A should receive the message, however it currently doesn't.

@mcollina
Copy link
Collaborator

Yes, absolutely.

Would you mind sending a PR?

@benlikeshotchocolate
Copy link

I'm having the same issue as described above.

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

No branches or pull requests

3 participants