Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    MQTT connection error Module ID: 49, error code: 134

    mainul
    Member

    MQTT connection error Module ID: 49, error code: 134

    Hello, I am a using my android phone's hotspot as a wifi connection, so there should not be any firewall problem. Connection to the wifi is okay but  sometimes, XDK can not connect to 

    "broker.hivemq.com" at port 1883 and showing the following error which is very weird (because sometimes it connects to hivemq broker).    

     

     INFO | XDK DEVICE 1: Error in XDK110 Application package.

     INFO | XDK DEVICE 1: Package ID: 153

     INFO | XDK DEVICE 1: Module ID: 49

     INFO | XDK DEVICE 1: Severity code: 2

     INFO | XDK DEVICE 1: Error code: 134

     

    I tried to decode this message from this community link 

    Package ID is 153. It is from XDK110 Application.

    Module ID: 49 refers to (from  XdkCommonInfo.h)  SERVAL_BASED_MQTT (I found this refers to SDK/XDK110/common/source/connectivity/SerervalMqttAgent.c ) 

    Error code 134 refers to (from  XdkCommonInfo.h) : RETCODE_MQTT_CONNECT_SEND_FAILED 

    I don't understand why?
    About, the public broker.hivemq.com , we don't need any user name and passowrd but without two field the code was not working at all. So, I used those field with default value give in the XDK example. 

     

    static MQTT_Connect_T MqttConnectInfo =

            {

                    .ClientId = APP_MQTT_CLIENT_ID,

                   .Username = APP_MQTT_USERNAME,

                    .Password = APP_MQTT_PASSWORD,

                    .BrokerURL = APP_MQTT_BROKER_HOST_URL,

                    .BrokerPort = APP_MQTT_BROKER_HOST_PORT,

                    .CleanSession = true,

                    .KeepAliveInterval = 100,

            };/**< MQTT connect parameters */

     

    /**

     * APP_MQTT_BROKER_HOST_URL is the MQTT broker host address URL.

     */

    #define APP_MQTT_BROKER_HOST_URL            "broker.hivemq.com"

     

    /**

     * APP_MQTT_BROKER_HOST_PORT is the MQTT broker host port.

     */

    #define APP_MQTT_BROKER_HOST_PORT           UINT16_C(1883)

     

    /**

     * APP_MQTT_CLIENT_ID is the device name

     */

    #define APP_MQTT_CLIENT_ID                  "XDK_MQTT_EXAMPLE"

     

    /**

     * APP_MQTT_USERNAME is the username for the connection to MQTT brocker.

     */

    #define APP_MQTT_USERNAME                  "YourUsername"

     

    /**

     * APP_MQTT_PASSWORD is the Password for the connection to MQTT brocker.

     */

    #define APP_MQTT_PASSWORD                  "YourPassword"

     

    /**

     * APP_MQTT_TOPIC is the topic to subscribe and publish

     */

    #define APP_MQTT_TOPIC                      "mqtt/xdk/topic"


     

    Tags (1)
    2 REPLIES 2
    LlobetAtWork
    Long-established Member

    Re: MQTT connection error Module ID: 49, error code: 134

    Hi mainul,
    Is the XDK capable to connect to the broker? From the error code you have de-coded, it looks like it could connect to the Hive MQ test broker. Sometimes the connection might not be stable with public test servers/brokers and I have identified versions of brokers which do not fully support the Bosch ServalStack implementation we feature in XDK. Try to connect without the username/password strings (by setting them to NULL), try to connect to another public MQTT broker or try to set-up a local Mosquitto (v1.5.7) instance on your PC or a Raspberry Pi to test the service.

    Best regards,

    Francisco Llobet

    mainul
    Member

    Re: MQTT connection error Module ID: 49, error code: 134

    Mosquitto 1.5.7 seems to solve the reconnect and disconnecting problem. 

     

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist