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

Add stopClient to close connection without sending disconnect message #39

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

albertov
Copy link
Contributor

@albertov albertov commented Jun 30, 2023

This is necessary to ensure the last-will message is delivered by the broker when using protocol MQTT 3.1.1 (which has no disconnect-with-will disconnect reason).

@albertov
Copy link
Contributor Author

Relevant section of the spec:

On receipt of DISCONNECT the Server:
MUST discard any Will Message associated with the current connection without publishing it, as described in Section 3.1.2.5 [MQTT-3.14.4-3].

http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718090

So sending a DISCONNECT message unconditionally causes a compliant MQTT 3.1.1 broker to discard the will message. This is a similar situation as other MQTT library authors face, eg empicano/aiomqtt#28

@dustin dustin merged commit 0112da2 into dustin:master Jun 30, 2023
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

Successfully merging this pull request may close these issues.

2 participants