I am using if (!wificonnected) reconnect();
Or something similar, it tries to reconnect if a connection is lost.
I'm not sure exactly whats happening on the esp8266 as I cannot connect to its serial in the application.
Its a module with a esp8266 chip and a u.fl. connecter, I'm using a 6" pigtail to a chassis mount sma socket, with a 9db whip on the other end of the steel control panel the esp is in, the router is about 120 meters away, but theres a steel wall partially in the way, and this is a noisy industrial environment, there is a container full of ac and dc drives overhead of my office where the router is.