Closed jahnli closed 3 years ago
You can use topic filtering here, use this to filter for your topic of interest, your listener stream still receives all topics.
Is there a way to make the listener flow accept only one topic
At present, I have two pages that require message callback use update.listen, I don't know whether to do update.listens on both pages or do it in one place
@shamblett Looking forward to your reply
Not sure what you mean, if you attach a topic filter to the client and listen on it you will only get updates for that topic, not others, you can chain topic filters or attach as many as you like. Don't know what you mean by 'pages', I don't use flutter so I wouldn't know how best to do this in your case. Please read the API docs.
I mean can it be used in multiple places (updates.listen or filter ) ? @shamblett
Yes its a broadcast stream all listeners will receive the filtered topic
There is an example of topic filtering in the examples directory, named mqtt_client_wildcard_filtered.dart. Maybe if you looked through these examples first and read the API docs you will get further with this.
How can a client receive callbacks for only one topic
I currently subscribe to multiple topics, but I only want to receive callbacks from one topic. What should I do