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
Retain MQTT client id #3001
base: master
Are you sure you want to change the base?
Retain MQTT client id #3001
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the intended effect of this change? The sessionStorage model also stores the client id.
Ah.. being able to subscribe to the the id is nice. Maybe we should make this more explicit by publishing it retained to the $bridge\origin\client-id
instead of doing it indirectly via the sessionStorage. What do you think @mworrell
The motivation for this is to get notified immediately after a custom worker connects. |
Retained in |
What I wanted to prevent was that you need to know the location of the client-id of the bridge and get it from some session storage topic. It was a bit strange for me to also use retained messages to the session storage model post calls. With this change the client-id is now stored in two locations. One as retained message, and second in the session storage. That is probably not a good idea. Is it possible to just store it just as a retained message? And maybe move this before the code which publishes the client id?
It is probably a bit tricky with respect to race conditions during reconnects. What do you think @mworrell? |
Maybe we could add a small broker function to do a retained value lookup? Then we can remove the session storage of client-id. |
I was thinking about that too.. What would also possible/handy is an add an option to subscribe on which the callback is immediately notified, also when there are no retained messages. But the retained value lookup is simpler I think. |
Description
Adds the possibility to subscribe into
model/sessionStorage/post/mqtt-origin-client-id
topic.The only changed thing is the
{ retain: true }
option.Checklist