I have a problem to change a definition how client is handled.
First in AP mode :
WiFi.mode(WIFI_AP);
WiFi.softAP("Test AP", "");
server.on("/", handle_AP_OnConnect);
server.on("/setting", handle_AP_Setting);
server.begin();
then I will change mode to STA and change definitions :
WiFi.mode(WIFI_STA);
server.stop();
WiFi.begin(esid.c_str(), epass.c_str());
while (WiFi.status() != WL_CONNECTED){
server.on("/", handle_OnConnect);
server.begin();
but when client is connected, always will receive a web page from "handle_AP_OnConnect"
What's wrong or how to modify correctly ?
Thanks
Alex
For ESP32: Calling the on() method on the same object again with the same URL path does not overwrite the previous handler but adds another one which will never be called. The library doesn't include functionality to remove a handler (yet).