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

MQTTv5. on_publish. Added reasonCode, properties arguments #656

Closed
wants to merge 3 commits into from

Conversation

trezorg
Copy link

@trezorg trezorg commented Apr 19, 2022

No description provided.

@MikeDombo
Copy link

💯 Please add this in! This is very necessary

@call-me-matt
Copy link

call-me-matt commented Apr 27, 2023

Thank you for this great contribution! I stumbled into the same issue. With the help of your PR, I can now check the reasoncode in the on_publish-callback. It is the only way to find out if my published message has been rejected due to access control.

Next, we should also modify the return code of the publish function itself. Currently it is always Success - in contrast to the mqtt lib for nodejs, for example. (I described this in more detail in issue #715)

@stonek4
Copy link

stonek4 commented Jul 26, 2023

It would be fantastic to get this merged in, we recently came across a bug related to this and have no workaround until this is merged in.

@PierreF
Copy link
Contributor

PierreF commented Dec 20, 2023

This will cause a breaking change. Any user that have a working client with MQTTv5 (but don't need reasonCode or properties) will have their client broken.

My two idea to avoid this is:

  • if doable reliably detect the number of argument accepted by on_publish and adapt argument send accordingly.
  • If the detection isn't doable or reliable enough (I think to *args or **kwargs cases), we might make it an option. But I think the option should not be tied to protocol used.

Also could you add a "Signed-Off" to your commit (option "-s" to git commit CLI). Eclipse ask us to verify its presence, which serve as confirmation that you agree with the ECA.

mid: matches the mid variable returned from the corresponding
publish() call, to allow outgoing messages to be tracked.
reasonCodes: the MQTT v5.0 reason codes received from the broker for each
subscription. A optional ReasonCodes instances. May ne None.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
subscription. A optional ReasonCodes instances. May ne None.
subscription. A optional ReasonCodes instances. May be None.

@PierreF
Copy link
Contributor

PierreF commented Dec 22, 2023

I've just seen that we already had something similar to you change with the on_connect callback. But I still think we should avoid breaking.

After a second though I think a explicit option to decide which callback API to use is better than auto-detection.

@PierreF
Copy link
Contributor

PierreF commented Jan 21, 2024

Thank for your contribution. Closing this PR because #802 fix the same issue as this PR.

@PierreF PierreF closed this Jan 21, 2024
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.

5 participants