0

How often should esp8266 have to re connect?
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

How often should esp8266 have to re connect?

by jasperp on Sat May 07, 2016 5:29 am

I am using the esp8266 and its example code which is working great however I found that most of the time after triggering my Dashboard Toggle Button and it being auctioned the esp8266 is having to re connect to the IO server. This is shown in the serial console as followed

Connecting to MQTT... MQTT Connected!

Should it be disconnecting from adafruit IO after most MQTT requests and actions or should a disconnect / reconnect only occur very rarely?

Note im using my ESP8266 in Australia and my average ping to the IO server is 300ms.

jasperp
 
Posts: 50
Joined: Mon May 27, 2013 5:06 am

Re: How often should esp8266 have to re connect?

by jasperp on Sat May 07, 2016 6:02 am

Just a quick update, iv tried increasing the ping time out in the MQTT.h file to 1.5 second but I still get a disconnect/reconnect after doing most button pushed.

Iv now removed
Code: Select all | TOGGLE FULL SIZE
  // ping the server to keep the mqtt connection alive
  //  if(! mqtt.ping()) {
  //    mqtt.disconnect();
  // }


from my code and im still able to use my dashboard buttons 30 minutes later and iv had no disconnect/reconnects in my serial monitor.

Could someone clear up why he mqtt.ping() is actually needed? There is a mqtt.connected() check I run every 10 seconds, should this be enough to re connect if there is a real drop out?

Thanks and sorry for double post, I couldn't see an EDIT button for my first post anywhere, just delete and report.

jasperp
 
Posts: 50
Joined: Mon May 27, 2013 5:06 am

Please be positive and constructive with your questions and comments.