Hi,

 

I am using the simple MQTT client example and moddified it with my WLAN and MQTT connection parameters.

The client connects successully, sends and receives messages.

However the connection is dropped intermittently and eventually the client will not re-connect.

The MQTT broker (Solace PubSub+) reports a client disconnect - "reason(Header Parse Error)".

 

Any ideas?

 

Thanks

Swen

The application logging on the XDK console log reports the following:

INFO | XDK DEVICE 1: MqttEventHandler : Event - 17

 INFO | XDK DEVICE 1: MqttEventHandler : Event - 4

 INFO | XDK DEVICE 1: AppControllerFire : MQTT publish failed 

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

 INFO | XDK DEVICE 1: Package ID: 153

 INFO | XDK DEVICE 1: Module ID: 39

 INFO | XDK DEVICE 1: Severity code: 2

 INFO | XDK DEVICE 1: Error code: 120

 

 

 

 

0 (0 Votes)
RE: MQTT Client gets disconnected intermittently
Answer
1/11/19 3:28 PM as a reply to Swen-Helge Huber.
Hello Swen,

Given that you have an issue with the MQTT broker being unable to interpret the header,
I suspect the broker you are using may have certain restrictions that are not fulfilled.
Those could be for example topic format, encryption, authentification or authorisation.
Did you try your implementations with another free broker like mosquitto or HiveMQ .

For interpreting the errors you can refer to
SDK > xdk110 > Common > include > Connectivity > XDK_MQTT.h .
MQTT event 17 refers to MQTT_PUBLISH_SEND_FAILED and event 4 refers to MQTT_CONNECTION_CLOSED
Which again leads to an issue with a rejection from the MQTT broker, the connection itself to the MQTT broker seems to not be the issue.

About you disconnect being intermittently, did you receive the payload on the broker side? It seems rather odd that you get into a header issue after succesful transfer.

Please let me know if this was helpful and if you have further questions do no hesitate to ask.

Kind regards,
Franjo
0 (0 Votes)
RE: MQTT Client gets disconnected intermittently
Answer
1/14/19 5:05 PM as a reply to Franjo Stjepandic.

The thing is - why I am asking this here - is that the client pushes and receives hundreds of messages without issue for minutes.

And then it fails - so the issue could be the broker but also the client. Is the client sending some sort of keep alive messages periodically?

Could something like heartbeat otr status messages be different form regular messages transmitted?

I would like to uynderstand a bit better how the ServalStack works but there seems to be pretty minimal information on it on the web apart form the XDK documentation?

0 (0 Votes)
RE: MQTT Client gets disconnected intermittently
Answer
1/15/19 3:49 PM as a reply to Swen-Helge Huber.
Hello Swen,

Thank you for clarifying your issue.
I assume the failing is resulting from the XDK going into an assert? Am I right so far?

If yes, than is that most likely caused from the XDK losing temporarily the connection to the MQTT broker. This can be caused if the XDK loses the Wi-Fi connection. Please note that the XDK is not covering an underlying Wi-Fi reconnect routine.

Did you implement a routine, which is checking the Wi-Fi connection?

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Votes)