Function esp_idf_svc::sys::httpd_ws_recv_frame

source ยท
pub unsafe extern "C" fn httpd_ws_recv_frame(
    req: *mut httpd_req,
    pkt: *mut httpd_ws_frame,
    max_len: usize,
) -> i32
Expand description

@brief Receive and parse a WebSocket frame

@note Calling httpd_ws_recv_frame() with max_len as 0 will give actual frame size in pkt->len. The user can dynamically allocate space for pkt->payload as per this length and call httpd_ws_recv_frame() again to get the actual data. Please refer to the corresponding example for usage.

@param[in] req Current request @param[out] pkt WebSocket packet @param[in] max_len Maximum length for receive @return

  • ESP_OK : On successful
  • ESP_FAIL : Socket errors occurs
  • ESP_ERR_INVALID_STATE : Handshake was already done beforehand
  • ESP_ERR_INVALID_ARG : Argument is invalid (null or non-WebSocket)