Merge branch 'feature/support_ws_handshake_callback' into 'master'

example: Identify the callback whether is hanshake or frame-receive by req->method

Closes IDFGH-4796 and IDFCI-488

See merge request espressif/esp-idf!12634
pull/6718/head
Mahavir Jain 2021-03-09 12:11:56 +00:00
commit 67cb6b98f8
2 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -67,6 +67,10 @@ static esp_err_t trigger_async_send(httpd_handle_t handle, httpd_req_t *req)
*/
static esp_err_t echo_handler(httpd_req_t *req)
{
if (req->method == HTTP_GET) {
ESP_LOGI(TAG, "Handshake done, the new connection was opened");
return ESP_OK;
}
httpd_ws_frame_t ws_pkt;
memset(&ws_pkt, 0, sizeof(httpd_ws_frame_t));
ws_pkt.type = HTTPD_WS_TYPE_TEXT;

Wyświetl plik

@ -33,6 +33,10 @@ static const size_t max_clients = 4;
static esp_err_t ws_handler(httpd_req_t *req)
{
if (req->method == HTTP_GET) {
ESP_LOGI(TAG, "Handshake done, the new connection was opened");
return ESP_OK;
}
httpd_ws_frame_t ws_pkt;
memset(&ws_pkt, 0, sizeof(httpd_ws_frame_t));