I'm streamming MJPEG with esp_http_server.h.
Within one of its handler I make an infinite loop ( while(true) ).
I want to process another handler while in infinitive loop.
How to do that ?
Thanks
Let esp_http_server running another handler while infinite loop
-
- Posts: 1708
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Let esp_http_server running another handler while infinite loop
Don't loop inside the HTTP request handler.
Instead, use httpd_req_to_sockfd() to get the connection's socket when handling the request; pass this socket to another task and return from the request handler. The other task can then loop using httpd_socket_send() to send data while the HTTP server is free to handle other requests.
Instead, use httpd_req_to_sockfd() to get the connection's socket when handling the request; pass this socket to another task and return from the request handler. The other task can then loop using httpd_socket_send() to send data while the HTTP server is free to handle other requests.