This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220SF: Multi MQTT connections.

Part Number: CC3220SF


Hi,

I want to connect to multiple MQTT broker at the same time. I am starting with 2 MQTT connection. Is there a way to achieve this?

  • yes, it is support by the MQTT stack (from the CC32XX SDK).

    You will need to create 2 instances of clients.

    if you are using through MQTT_IF you will need some updates as the module is currently supporting only one instance, e.g. mMQTTContext should be extended (as array of list) and only one instance of the contextThread should only be used.

    In such case you better use the MQTT_IF_Connect just as a reference to the way you should interface the MQTT stack.

  • There are multiple variables used internally that needs to be changed to array, and the functions need to know which client is to be handled so i will have to pass client array index for each variable  for different functions.

    So I have to do changes in the library provided, there is no such setting or Macro that can enable multi-Connections in MQTT?

  • the MQTT library should be able to support multiple connections.

    The MQTT_IF which is an application code (that tries to simplify the interface to the library) is only supporting one instance.

    so your options are:

    1. You can remove the MQTT_IF and interface to the MQTTClient library directly from the application.

    2. You can update MQTT_IF to support multiple instances (as you said there are couple of variables that needs to be changed to support an array of MQTT connections).

    3. You can also use any external MQTT stack (that supports multiple connections) and bind it to the simplelink TCP sockets.