aiomqtt icon indicating copy to clipboard operation
aiomqtt copied to clipboard

Question: How can I add further subscriptions at runtime.

Open Manuel83 opened this issue 3 years ago • 3 comments

Hi The advanced example is working well. How can I add further subscriptions at runtime?

Manuel83 avatar Mar 13 '21 15:03 Manuel83

Hi Manuel. Thanks for the question. :)

Glad to hear that the advanced example works for you. You can call client.subscribe as many times as you want.

If that doesn't answer your question then please show us (with code) what you've tried so far. :+1:

frederikaalund avatar Mar 13 '21 17:03 frederikaalund

Also related: I have used client.subscribe() at runtime which works well. Is there also a way to update the filtered topics too? Otherwise it would default to incoming messages being handled by the unfiltered messages task/function.

chan-vince avatar Jun 20 '21 11:06 chan-vince

Hi chan-vince. Thanks for the question. Let me try to answer.

Is there also a way to update the filtered topics too? Otherwise it would default to incoming messages being handled by the unfiltered messages task/function.

Like client.subscribe, you can call client.filtered_messages as many times as you want. If you want to "update" a filter, I suggest that you simply exit the current filter and enter a new one. Does it make sense? :) If it doesn't answer your question, then please show us some code of what you've tried so far.

frederikaalund avatar Jun 20 '21 12:06 frederikaalund

As there have been no more responses, I'm closing this off. If there's anything left unclear, just reopen 😉

empicano avatar Nov 15 '22 01:11 empicano