-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Client does not resubscribe after reconnect if clean = false #895
Comments
@#749 |
I just ran into this myself with MQTT.js 4.2.8 and using Mosquitto 2.0.12 as the broker, and was extremely surprised by the behaviour. Was there a specific reason for it behaving like this, or is it some unintended bug? |
This is an automated message to let you know that this issue has If this issue is still important, you can simply comment with a Thank you for your contribution. |
bump |
The sessionPresentFlag should be available since version 3.1.1. And it is possible for broker to lose the persistent session, in that case you would want the client to automatically resubscribe. Thus this line: Lines 2108 to 2110 in 18bdd49
Should be: (this.options.clean || (this.options.protocolVersion >= 4 && !this.connackPacket.sessionPresent)) && Right? This problem seem to be observed in multiple issues I can make a pull request for this. Not sure if this would be considered a breaking change, But I think most people woud expect resubscribe to work like this. |
Yeah that's a bug. Open a PR if possible, remember to add a test. Thanks |
Is there any reason we don't want resubscribe work if clean = false?
I have created a sub client with clean = false, and resubscribe = true, the client will not resubscribe the topics if MQTT aedes broker (no persistence) restart. And, sub-client will no longer receive the message of the topics
https://github.com/mcollina/aedes
https://github.com/mqttjs/MQTT.js/blob/master/lib/client.js
From MQTT.js/lib/client.js
I can provide my sub client code and broker code if necessary
The text was updated successfully, but these errors were encountered: