kopia lustrzana https://github.com/espressif/esp-idf
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!12634pull/6718/head
commit
67cb6b98f8
|
@ -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)
|
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;
|
httpd_ws_frame_t ws_pkt;
|
||||||
memset(&ws_pkt, 0, sizeof(httpd_ws_frame_t));
|
memset(&ws_pkt, 0, sizeof(httpd_ws_frame_t));
|
||||||
ws_pkt.type = HTTPD_WS_TYPE_TEXT;
|
ws_pkt.type = HTTPD_WS_TYPE_TEXT;
|
||||||
|
|
|
@ -33,6 +33,10 @@ static const size_t max_clients = 4;
|
||||||
|
|
||||||
static esp_err_t ws_handler(httpd_req_t *req)
|
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;
|
httpd_ws_frame_t ws_pkt;
|
||||||
memset(&ws_pkt, 0, sizeof(httpd_ws_frame_t));
|
memset(&ws_pkt, 0, sizeof(httpd_ws_frame_t));
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue