feat(esp_http_server): Added pre handshake callback for websocket

1. If the user wants authenticate the request, then user needs to do
this before upgrading the protocol to websocket.
2. To achieve this, added pre_handshake_callack, which will execute
before handshake, i.e. before switching protocol.
This commit is contained in:
hrushikesh.bhosale
2025-08-06 11:43:22 +05:30
parent 6b0b85b6a2
commit 3a7380f5bc
7 changed files with 142 additions and 9 deletions
+9
View File
@@ -58,4 +58,13 @@ menu "HTTP Server"
help
This config option helps in setting the time in millisecond to wait for event to be posted to the
system default event loop. Set it to -1 if you need to set timeout to portMAX_DELAY.
config HTTPD_WS_PRE_HANDSHAKE_CB_SUPPORT
bool "WebSocket pre-handshake callback support"
default n
depends on HTTPD_WS_SUPPORT
help
Enable this option to use WebSocket pre-handshake callback. This will allow the server to register
a callback function that will be called before the WebSocket handshake is processed i.e. before switching
to the WebSocket protocol.
endmenu