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

Subscribe RetainAsPublished misbehave with MQTT 3.1.1 #141

Closed
bkupidura opened this issue Jan 11, 2023 · 3 comments
Closed

Subscribe RetainAsPublished misbehave with MQTT 3.1.1 #141

bkupidura opened this issue Jan 11, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@bkupidura
Copy link
Collaborator

bkupidura commented Jan 11, 2023

Currently every message received by 3.1.1 MQTT client, will have retain flag set to false. Even when it was published with retained flag set to true.
MQTT 3.1.1 spec is not very specific about that, but previosly retain flag was set to whatever value was set in PUB packet.

This is because of https://github.com/mochi-co/mqtt/blob/0de1d731db5b4b94f580d1441560658303bdab2c/server.go#L788

AFAIK RetainAsPublished should be used only for v5 clients and for v3 it should be always set to 1

@mochi-co mochi-co self-assigned this Jan 13, 2023
@mochi-co mochi-co added the bug Something isn't working label Jan 13, 2023
@mochi-co
Copy link
Collaborator

I agree. I will try to fix this tomorrow if I get a chance, and push a new release.

@mochi-co
Copy link
Collaborator

This should be fixed in v2.1.5, try it out and let me know 👍🏻

@bkupidura
Copy link
Collaborator Author

@mochi-co its working as expected! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants