Developer Portal Community

    Showing results for 
    Search instead for 
    Did you mean: 

    'SendDataOverMqtt' works for some time and then fails.


    'SendDataOverMqtt' works for some time and then fails.

    I simply imported the SendDataOverMqtt template and setup wifi and Mqtt structs. Along with this I just added accelerometer data to be published along with pressure, temperature and light data.

    XDK sends data for about 2-3 minutes and then errors out. 

    Error in XDK workbench: 

    Error in XDK110 Application package.
    Package ID: 153
    Module ID: 39
    Severity code: 2
    Error code: 130
    AppControllerFire : MQTT publish failed

    Error at Mosquitto broker console:

    Client XDK_FS disconnected due to protocol error.

    Code is too big to be attached, but I only edited the following sections.

    1)  MQTT and Wifi Setup struct

    2) enabled the accelerometer in sensor struct and added it's values to snprintf(which works).

    Please help me decode this error. 


    7 REPLIES 7
    Long-established Member

    Re: 'SendDataOverMqtt' works for some time and then fails.


    There is no limitation in the client (XDK and application) for publish message count. Hence it has to do with the broker.

    Which version of workbench application are you using ? In the latest version v3.6.0 workbench, MQTT reconnection logic is added. With this reconnection logic, upon MQTT disconnection ; XDK will reconnect with the broker again and publish.


    Re: 'SendDataOverMqtt' works for some time and then fails.

    Hi Padma,

    Thankyou for your reply. I am using XDK 3.6.0 with mosquitto broker, are you aware of any known issues with mosquitto.

    Could you please share where can I find this reconnection logic?

    And  Could you please translate this error code?


    Thanks again

    Long-established Member

    Re: 'SendDataOverMqtt' works for some time and then fails.

    Hi Mishra,

    the non-AWS MQTT implementation has issues with some versions of Eclipse Mosquitto.

    Currently versions above 1.5.7 will stop receiving publications after 256 messages. Please use version 1.5.7 or below as broker. Even in this case, it is common for the broker to drop the connection in around 30 minutes. Since in MQTT v3.1 there is no server-to-client DISCONNECT message, the client will notice the disconnection due to publishing send failure or publishing timeout.In this case the client shall disconnect, close the sockets and reconnect.

    Kind Regards,



    Re: 'SendDataOverMqtt' works for some time and then fails.

    Hello Francisco,

    Thanks a lot. I am having a hard time downgrading to mosquitto1.5.6 . Is there a workaround for avoiding this disconnection? May be by changing MQTT protocol version on XDK side or on the broker(if possible) ? Also, do you recommend any other broker I can use, which is known to work flawlessly with the example code?