-->
Page 1 of 1

MQTT subscribe disconnects every few seconds

PostPosted: Wed Jan 14, 2015 5:18 am
by jonwise
I have esp_mqtt-master working and have removed the publishing code with the aim of making a unit to switch the heating in my greenhouse. It does receive the published messages but continually disconnects and reconnects to the MQTT server every few seconds. I get the debug messsage 'TCP: Disconnected callback' a second or so after the 'subscribe' message was sent. Any ideas please?

Solved: I was using test.mosquitto mqtt server which does not require formal registration and I did not realise the significance of the client Id until I found this from IBM - "If your MQTT client connects successfully and later disconnects with no apparent reason" - if "Another client is started and connects with the same client ID. ... In this case, WebSphere® MQ accepts the connection from the second MQTT client and forcefully disconnects the first MQTT client." I guess this is related to my problem as when I updated MQTT_CLIENT_ID in user_config.h, the problem went away.

Re: MQTT subscribe disconnects every few seconds

PostPosted: Sun Feb 22, 2015 1:44 pm
by lemon paeroa
Hi,
I have been trying to get the same sort of system running with no success.
Which MQTT library are you using / did you find the best?
Would you be interesting in posting a working MQTT sketch ?