Frequent MQTT Disconnects

Hello, I have a device that is connecting and reconnecting every few seconds. Below is a screenshot of what Losant is showing.

Hey @Steve_Ermish,

It looks like your device is establishing a new connection over and over again. Could you by chance be using the same device id for two devices?

When a device ID is reused, Device A will connect, then device B will connect, kicking off Device A. Then Device A will connect, and kick Device B off. This loop will keep happening.

Thank you,

Hi @Heath,

We are not reusing the IDs, each device currently uses its own ID and Access Keys to connect to Losant. Most of the other devices are working correctly but we have seen this frequent connection/disconnection problem on a few of our devices.

What could be other reasons for this?

The latest error in the log you posted says “Keepalive timeout”, and the interval of
the disconnects seems to hint at a problem with PING requests and responses,
but it could be any number of reasons.
A wireshark session would probably let you diagnose the problem.
Not knowing which type of device and it’s MQTT implementation, there is not much
to diagnose here. If you question it’s MQTT implementation, you would run it through
a MQTT protocol tester (google it).

I have to agree with @Heath here: The best explanation, given the messages displayed in your connection log and the consistent rhythm of the disconnections, is that the device ID is being used as the client ID in more than one connection to Losant’s MQTT broker. If you can provide us with a device ID for one of the devices where you are seeing this behavior, we can dig a little deeper.

Hi @Dylan_Schuster I think the duplicate client is not a possibility in terms of the flow we are using but I can check on that and confirm.

I will PM you one of the device ids.

Thank you