This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MQTT Subscriber support Multiple subscriber?

[Dev Env]

nRF51 DK

IoT SDK 0.8

IoT SoftDevice

MQTT Subscriber Example

[Question]

  1. i tested multi subscriber, but error returned. IoT SDK not Support multi subscriber?

    then received data contain all setting value?

    i try to subscriber multiple

      1) MacAddress/beacon/txpower
    
      2) MacAddress/beacon/broadcasting Interval
    
      .....
    
  2. if i want one beacon receive message, how can i do?

    like above , contain MacAddress to topic?

thank you.

Parents
  • I believe the correct way of doing this is to wait for the MQTT_PKT_TYPE_SUBACK control packet before you subscribe to a new topic.

    This event is not handled in the mqtt library.

    I would try to modify the library so it handles the event, and sends an event to the application.

    Add a case for MQTT_PKT_TYPE_SUBACK in recv_callback().

    Add a new event in the mqtt_evt_identifier_t struct. For example MQTT_EVT_SUBACK. Send this event to the application when you receive MQTT_PKT_TYPE_SUBACK.

    Add a case for MQTT_EVT_SUBACK in the app_mqtt_evt_handler(). Here you add your second subscription.

    I haven't tested this myself, just a suggestion.

Reply
  • I believe the correct way of doing this is to wait for the MQTT_PKT_TYPE_SUBACK control packet before you subscribe to a new topic.

    This event is not handled in the mqtt library.

    I would try to modify the library so it handles the event, and sends an event to the application.

    Add a case for MQTT_PKT_TYPE_SUBACK in recv_callback().

    Add a new event in the mqtt_evt_identifier_t struct. For example MQTT_EVT_SUBACK. Send this event to the application when you receive MQTT_PKT_TYPE_SUBACK.

    Add a case for MQTT_EVT_SUBACK in the app_mqtt_evt_handler(). Here you add your second subscription.

    I haven't tested this myself, just a suggestion.

Children
No Data
Related