Open intoku opened 1 year ago
Accidentally have found that if "server.begin();" is placed inside the "onConnectionEstablished()" function - than the server works. Not sure if this is the correct way to do it - can be helpful to anyone that needs the webserver active
Hey folks. Ran into the same issue. Wanted to run my own webserver alongside the built-in http-update server without success, getting the boot-loop as shown above.
I solved the issue by exposing the webserver which is already built into the esp32mqttclient class.
Inside EspMQTTClient.h add:
WebServer* webserver();
under the public: section (e.g. under enableHTTPWebUpdater())
Inside EspMQTTClient.cpp add:
WebServer* EspMQTTClient::webserver() { return _httpServer; }
Then you can move the http-update url to some path, eg.
client.enableHTTPWebUpdater("/update");
and add all hooks, you want for your own webserver like so:
client.webserver()->on("/", handle_root);
the handle_root function needs to look like:
void handle_root() { client.webserver()->send(200, "text/plain", "your answer"); }
Description of the problem
For my application i need to run Webserver.h on port 80 on the ESP32. The program is compiling properly - until "server.begin();" is called - afterwards the program compiles - but crashes when uploaded to ESP. Have tested the identical code with the standard library WiFi.h, where it works properly. I have tried with including and not including the Webserver.h - mostly same issue. Furthermore, disabling or fully removing the client.enableHTTPWebUpdater(); did not help,
Is there a way to use the Webserver.h from my script without this conflicts/errors with the EspMQTTClient library?
Other tries:
Versions
Hardware
Logs
C++ code