Send binary WebSocket frames in one write

This commit is contained in:
2026-09-08 23:52:00 +02:00
parent 042499e4d6
commit 60d9c54bb4
10 changed files with 334 additions and 8 deletions
+9
View File
@@ -26,6 +26,15 @@ void web_httpd_wipe_request(httpd_req_t *request, bool closing);
esp_err_t web_httpd_upgrade(httpd_req_t *request,
esp_err_t (*handler)(httpd_req_t *));
#define WEB_HTTPD_WS_BINARY_MAX_PAYLOAD 512U
/* HTTPD-owner work only; caller retains generation/lifecycle and one-work-slot
* ownership. Synchronous FIN/binary/unmasked send through the session override.
* Non-full writes synchronously block further session sends and abort the socket;
* caller must retain normal failure/cleanup accounting, never replay the frame. */
esp_err_t web_httpd_ws_send_binary(httpd_handle_t server, int fd,
const void *expected_context,
const uint8_t *payload, size_t length);
/* Serialized server startup only, exact-match ordinary GET, URI <= 127 bytes.
* Stage both allocations before publication; HTTPD owns/frees them on success. */
esp_err_t web_httpd_register_optional_get(httpd_handle_t server, const httpd_uri_t *uri);