Hello,
Trying to build an surveillance camera with the esp32-cam module, I want to be able to detect if a HTTP connection the the ESP32 as WEB server is started yes or not.
As basic sketch I am using the CameraWebServer.ino from the ESP-ARDUINO set.
I must say that I have a big problem to understand the esp_http_server library even reading the https://docs.espressif.com/projects/esp ... erver.html
and trying some examples of the https://github.com/espressif/esp-idf/tr ... ver/simple
I was unable to run any scripts without tons of errors (there are no actual practical ARDUINO alike examples )..
But basically my concerns is simple, I want to be able to detect an HTTP connection in order to switch from a "motion detection camera mode setting" (background activity) to a "streaming display camera mode setting" only when an HTTP connection is made, and of course return to the detection mode when the HTTP connection is closed.
So the first step to do this is to detect if a connection is done.
This looks straight forward with the (old?) Webserver.h library:
void WebServer::handleClient() {
if (_currentStatus == HC_NONE) {
WiFiClient client = _server.available();
if (!client) {
return;
Unfortunately all the camera examples I have are based on the esp_http_server.h one and I can't combine both libraries.
Can someone indicate me the function or a simple example that I should use based on the esp_http_server.h to detect if an HTTP connection is made to the ESP32 as Web server?
Next step is of course to switch from one mode to another, but first things first.
Thanks already
Robert
How to detect an HTTP connection with the esp_http_server.h library ?
Re: How to detect an HTTP connection with the esp_http_server.h library ?
Add an HTTP end point:
/api/v1/camera?mode=stream
You can make the above XMLRequest in Javascript when loading your index.html
Check w3schools for a basic AJAX overview.
If you don't want to decode parameters then:
/api/v1/camera/mode/stream
I am not sure which HTTP server you are using so you must read the manual and see how to add an end point, it will be simple.
/api/v1/camera?mode=stream
You can make the above XMLRequest in Javascript when loading your index.html
Check w3schools for a basic AJAX overview.
If you don't want to decode parameters then:
/api/v1/camera/mode/stream
I am not sure which HTTP server you are using so you must read the manual and see how to add an end point, it will be simple.
& I also believe that IDF CAN should be fixed.
Who is online
Users browsing this forum: Google Feedfetcher, ok-home and 209 guests