Closed denebchorny closed 3 years ago
Hi @denebchorny,
why do you need a persistent session when you want to delete all subscriptions anyway? Or are the user generated subscriptions only a subset of all subscriptions?
Greetings, Michael from the HiveMQ team
The MQTT protocol does not provide such functionality. https://groups.google.com/g/mqtt/c/VfED9cMPMvU/m/pCuNS6BEo3gJ
It sounds like you have an architectural problem, as there is no way to ensure execution before closing the session. The connection may be interrupted by network failure for example. ;-)
I will close this issue because of inactivity and because the best answer for the current information is to use the right session expiry. Please feel free to comment if you still think this question is unanswered.
Problem or use case
When a user enters the app they dynamically subscribe to some topics. When he closes the session of the app I would like to delete all these topics.
By the time the user closes the session I do not know what the subscribed topics are.
And very important, I am using clean session to false with a duration of 7200 seconds. So if at the time of closing the session I do not clear the topics, then, if the user should no longer have access to a topic and log in again, we will have a security problem.
Preferred solution or suggestions
A method just to notify broker: hey, delete all subscribed topics