This repo is based in the HTTP-Server example in tho the esp-idf, and in the streaming example of the esp32-cam repository.
-
Open the project configuration menu (
idf.py menuconfig
) to configure Wi-Fi or Ethernet. -
For esp32-camera enable the support for external SPRAM.
-
In order to test the HTTPD server persistent sockets demo:
- compile and burn the firmware
idf.py -p PORT flash
- run
idf.py -p PORT monitor
and note down the IP assigned to your ESP module. The default port is 80 - test the example :
- run the test script : "python scripts/client.py <IP> <port> <MSG>"
- the provided test script first does a GET \hello and displays the response
- the script does a POST to \echo with the user input <MSG> and displays the response
- or use curl (asssuming IP is 192.168.43.130):
- "curl 192.168.43.130:80/hello" - tests the GET "\hello" handler
- "curl -X POST --data-binary @anyfile 192.168.43.130:80/echo > tmpfile"
- "anyfile" is the file being sent as request body and "tmpfile" is where the body of the response is saved
- since the server echoes back the request body, the two files should be same, as can be confirmed using : "cmp anyfile tmpfile"
- "curl -X PUT -d "0" 192.168.43.130:80/ctrl" - disable /hello and /echo handlers
- "curl -X PUT -d "1" 192.168.43.130:80/ctrl" - enable /hello and /echo handlers
- run the test script : "python scripts/client.py <IP> <port> <MSG>"
- compile and burn the firmware
-
If the server log shows "httpd_parse: parse_block: request URI/header too long", especially when handling POST requests, then you probably need to increase HTTPD_MAX_REQ_HDR_LEN, which you can find in the project configuration menu (
idf.py menuconfig
): Component config -> HTTP Server -> Max HTTP Request Header Length -
Access to the camera streaming in the /cam url.