0

I am using AWSIoT iOS SDK (version 2.6.0) in my current application.

To subscribe the topic currently, we are using below method of SDK

- (BOOL) subscribeToTopic:(NSString *)topic
                      QoS:(AWSIoTMQTTQoS)qos
          extendedCallback:(AWSIoTMQTTExtendedNewMessageBlock)callback

Can you please let me know how can we subscribe to multiple topics with the single method call?

Thanks in advance.

iDev
  • 531
  • 1
  • 5
  • 15
  • As far as I am aware there is no method available that provides ability to subscribe to multiple topics at once but what is stopping you from subscribing to multiple topics by simple calling this method for each topic? – Peter Pajchl Dec 06 '18 at 17:27

2 Answers2

1

If you want to subscribe to a 'topic tree' i.e. multiple topics, use '+' or '#' E.g., if you have these topics: mydevice/temp/sensor1 mydevice/temp/sensor2 mydevice/humidity/sensor1 mydevice/humidity/sensor2

Subscribing to "mydevice/temp/+" gives you messages from both temp sensors, subscribing to "mydevice/#" gives you all temp and humidity sensors. The '+' is a single level wild card, the '#' a multi-level wild card.

Yohst
  • 1,671
  • 18
  • 37
-1

Will not work out by calling one method subscribe on one topics. Use NSNotifacationCenter

Sasha Tsvigun
  • 311
  • 5
  • 15