mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-18 15:47:13 +00:00
esp_http_server: Add Websocket API to return list of active clients
Closes https://github.com/espressif/esp-idf/issues/5406
This commit is contained in:
@@ -383,15 +383,15 @@ esp_err_t httpd_ws_get_frame_type(httpd_req_t *req)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
int httpd_ws_get_fd_info(httpd_handle_t hd, int fd)
|
||||
httpd_ws_client_info_t httpd_ws_get_fd_info(httpd_handle_t hd, int fd)
|
||||
{
|
||||
struct sock_db *sess = httpd_sess_get(hd, fd);
|
||||
|
||||
if (sess == NULL) {
|
||||
return -1;
|
||||
return HTTPD_WS_CLIENT_INVALID;
|
||||
}
|
||||
bool is_active_ws = sess->ws_handshake_done && (!sess->ws_close);
|
||||
return is_active_ws ? 1 : 0;
|
||||
return is_active_ws ? HTTPD_WS_CLIENT_WEBSOCKET : HTTPD_WS_CLIENT_HTTP;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_HTTPD_WS_SUPPORT */
|
||||
|
Reference in New Issue
Block a user