Imagine I write a custom app and I want to give the user the possibility to subscribe to various events on various brokers. My idea is to create a custom doctype in which the user can specify all credentials, the topic etc for a subscription the user wants to have. On save of that document I spawn a new mqtt client (or stop an existing), trying to subscribe to the given topic in a loop until the document is deleted or changed.
Is that the way to go? Or where would you put the code to startup the mqtt client?
I was unable to find the existing event doctype of Frappe, maybe its done in a similar way there?