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"
Solved! Go to Solution.
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.