Topic: Subscribe To Several Topics

Hi Forum,

Is it possible to subscribe to several topics ?

Any example will be appreciated.

Thank you.


Re: Subscribe To Several Topics

Hi rlev,

Yes, when using the MqttClient_Subscribe API to subscribe, you can pass as many topics as you'd like in the array MqttSubscribe->topics as long as you set topic_count correctly.
Here are a couple of examples that subscribe to a single topic, to expand them you'd just iterate over each topic and set their parameters accordingly: … ent.c#L383 … ple.c#L399