Can't use httpd_ws_frame_t structure in ESP32-C3

LuvKira
Posts: 11
Joined: Fri Feb 24, 2023 5:43 am

Can't use httpd_ws_frame_t structure in ESP32-C3

Postby LuvKira » Thu Sep 28, 2023 3:51 am

I have an ESP32-C3 project. Even though I have defined the esp_http_server header file and enabled CONFIG_HTTPD_WS_SUPPORT, the ESP-IDE still returns the following message: "Type 'httpd_ws_frame_t' could not be resolved". How can i fix it ? Here's what i included in my project :

#include "stdio.h"
#include "string.h"
#include "unistd.h"

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include "esp_mac.h"
#include "esp_wifi.h"
#include "esp_event.h"
#include "esp_log.h"
#include "esp_system.h"
#include "esp_http_server.h"
#include "esp_tls.h"
#include "esp_timer.h"
#include "esp_task_wdt.h"
#include "esp_netif.h"
#include "esp_eth.h"
#include "esp_http_server.h"

#include "nvs_flash.h"

#include "lwip/err.h"
#include "lwip/sys.h"
#include "lwip/sockets.h"
#include "lwip/netdb.h"
#include "lwip/udp.h"

#include "sys/param.h"

#include "nvs_flash.h"

#include "driver/uart.h"
#include "driver/gpio.h"
#include "cJSON.h"

MicroController
Posts: 1552
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Can't use httpd_ws_frame_t structure in ESP32-C3

Postby MicroController » Thu Sep 28, 2023 1:03 pm

1) make sure your project REQUIRES esp_http_server in CMakeLists.txt
2) reconfigure/rebuild the project; this may nudge the IDE to re-evaluate and pick up all include paths.

mtaz78
Posts: 14
Joined: Thu Nov 23, 2023 3:32 pm

Re: Can't use httpd_ws_frame_t structure in ESP32-C3

Postby mtaz78 » Wed Dec 06, 2023 10:19 am

Hi, the problem lies in the sdkonfig file. To support WebSocket and use the httpd_ws_frame_t you have to enable this paramenter CONFIG_HTTPD_WS_SUPPORT, you can find it in the sdconfig file and enable it using the command:

idf.py menuconfig

and going to Component config > HTTP Server.

You can find the reference here https://docs.espressif.com/projects/esp ... ws-support

Who is online

Users browsing this forum: benskiskull, Bing [Bot] and 245 guests