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

Handling SUBACK with Failure code #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jesjobom
Copy link

@jesjobom jesjobom commented May 9, 2019

Whenever my broker rejects a Subscribe (because it was not authorized) it'll send the code 0x80 replacing the QoS in the SUBACK.
(See MQTT 3.1.1 Protocol SUBACK http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718068)
But this mqtt client does not handle SUBACK codes, it only accepts any SUBACK as a subscription confirmation.

I made a change to verify if any of the returned QoS codes is 0x80 (there can be multiple topics in the requested Subscribe) and then call the Failure Callback if there is at least one.
So, it'll be possible to have both callbacks being called when some topics are accepted and others rejected.

Also, the Failure Callback does not support any other parameter asside from an exception.
So there's no way to acquire the failed topic in the callback. But it is possible to verify the QoS codes (passed as parameter) in the success callback.

This verification is compatible with MQTT 3.1.

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.

None yet

1 participant