Mqtt node issue

Mqtt node gets connected intermittently ie its status fluctuates from “disconnected” to “connecting” & then “connected” & then back to “disconnected”. Kindly help to get it connected consistently




Same question has been posted to OPTO 22

And they have responded.

Maybe its a network problem with your device or maybe event grid itself?

Doesn't seem related to Node RED IMO - but then I don't do much MQTT (but when I do its fine) - I don't use any 3rd Party appliance.

MQTT connection in Node Red is rock solid.
If the network or the other device is flaky, then you might see this. I’d look there.

The usual reason for MQTT clients cycling back and forth from connected/disconnected is that there is more than one client connecting with the same client id.

MQTT client ids must be unique, the spec says that when a second client connects with the same client id, the broker MUST disconnect the first. This usually results in the first client trying to connect again, which kicks off the other and this then repeats until the problem is fixed.