Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto reconnect missing features ? #25

Open
tabvn opened this issue Aug 15, 2016 · 6 comments
Open

Auto reconnect missing features ? #25

tabvn opened this issue Aug 15, 2016 · 6 comments

Comments

@tabvn
Copy link

tabvn commented Aug 15, 2016

it works fine however turn off socketio server for 1 second and start it

ESP8266 could not auto reconnect again socket send and receive now lost.

i hope this features could be added son.

@washo4evr
Copy link
Owner

Hi,

Yes, it will not reconnect
for now, I would suggest you check with a ping sent from the ESP
if you dont get a pong back, then, you can start to reconnect

When time permits it, I will add a timeout option to auto-reconnect

@tabvn
Copy link
Author

tabvn commented Aug 17, 2016

I understand thanks for quick reply. I decided to use ESP.reset() or, ESP.restart() when detect disconnection from Socket server. Seem only this way. i hope someone have better idea.

@washo4evr
Copy link
Owner

my goal is to add directly to the function connect a new timeout argument.
if after t (in milliseconds), no communication from the server, then initiate a reconnect

@raphael-fernandes
Copy link

Hi @tabvn!
I think the code below in the loop() will work:

if (!client.connected()) { client.reconnect(host, port); delay(5000); }

@washo4evr
Copy link
Owner

if you do that, you will loose connection and if need be, you will reconnect

you can also user a timer library to send a ping from the ESP to make sure the connection never dies

@HudsonProdigy
Copy link

I am a bit confused on how i should be sending ping from esp? is this what the heartbeat function is for? If so. how is it used?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants