Open niklasdoerfler opened 8 years ago
You can just use;
ESP.reset();
Thank you for your answer! I replaced the last while loop with your code, but it doesn't really help me with my actual problem, not knowing when the Websockets disconnects. It only resets the ESP when the WiFi connection gets lost.
Does anybody know how to notice if the websocket connection is lost?
Thanks in advance!
I Use the if condition each time before listening/sending data over the socket. if (clientsio.connected())
On Sat, Apr 30, 2016 at 3:19 PM, Niklas Dörfler notifications@github.com wrote:
Thank you for your answer! I replaced the last while loop with your code, but it doesn't really help me with my actual problem, not knowing when the Websockets disconnects. It only resets the ESP when the WiFi connection gets lost.
Does anybody know how to notice if the websocket connection is lost?
Thanks in advance!
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/morrissinger/ESP8266-Websocket/issues/14#issuecomment-215999461
Yes, thats what I also do. But it only checks, if the WiFi connection is connected. I want to check, if the socket is still working. Therefore I need some method like this from the class 'WebSocketClient'...
@niklasdoerfler Did you try using any other method to detect websocket connection lost? the client.connected() method works whenever I reset my server. i.e it detects that the server connection was completely dropped. But other than that if there is some random issue due to which socket connection is lost then this function call doesn't really help
Hi everyone! I'm also having websocket timeout problem. Is there some WebSocketClient method that checks if websocket connection was lost?
you can do a heart beat between server and client and if not working then disconnect and reconnect again
I know it's late, but anyway, I'm gonna share how I solved this problem: I decided to use the native ESP firmware (it's written in Lua, but don't worry! It has a good documentation and it's simple to understand, trust me :D).
There is a module to work with websocket and worked consistently well in my project. Here is the documentation about the module: https://nodemcu.readthedocs.io/en/master/en/modules/websocket/
I hope it helps! Hugs!
hi @mauricioribeiro can you share your code or example how you actually solved this ? do you still use the following websocket library = https://github.com/Links2004/arduinoWebSockets/blob/master/src/WebSocketsClient.h
@modabasi @niklasdoerfler I'm using Arduino IDE 1.6.5 and NodeMcu(ESP8266) as web-socket client_Demo Example My host is same "echo.websocket.org" with port 80 and geting that kind of response
Connecting to Local_wifi_Network ........ WiFi connected IP address: 172.161.131.153 Connected Waiting... Waiting... Waiting... Waiting... Waiting... Handshake successful ..............(After just that I got ) Client disconnected. Client disconnected.
So there is just 2 or 3 Sec between "Handshake successful" and "Client disconnected" I think there was problem in Connection Timeout but when I found #define TIMEOUT_IN_MS 10000 So I think there are some other problem Let me know if Someone did that connection successfully.
I need to try WSS (with port 443)
Hey,
I'm using this library to listen to a websocket in client mode. I'm trying to control a led stip with the esp8266 module. Everything works fine, but after some time the socket doesn't get the data from the server. Is there a way to reset the controller if socket connection is lost?
Thanks in advance :)
My code: