Espidf framework compatible websocket library

Hi guys,

I cannot find a WebSocket client for espidf framework with platformIO.

I tried few libraries already. for an example when i use PlatformIO Registry

it says
src\main.c:33:23: fatal error: Websocket.h: No such file or directory

How can i connect to my webscoket server when using espidf framework ?


duh, if anyone else is looking for the answer i copied the esp_websocket_client.c and esp_websocket_client.h from idf to a new project, compiled and it worked.

example code can be found at

1 Like

This isn’t the recommended way because the referenced library wasn’t meant neither for ESP32 nor for ESP-IDF.
Good that it worked in the end; however, it wasn’t tested for that framework.
I would look for another library first.

1 Like

Thank you for your input.

I could not find a library that works with IDF in the library search. What do you recommend ?


Hmmm, I couldn’t find it either :slight_smile: but there are some for Arduino ESP32. Maybe they will compile and work too. But I guess if your approach works for you, then ok. I don’t know why adding esp_websocket_client.h fixed websocket.h not being found, but ok.

1 Like

Perhaps a point of clarification. I strongly doubt PlatformIO Registry worked with simply copying those files from, since that library was for mbed, not either of the espressif frameworks, and simply adding those headers will not satisfiy the #include "mbed.h" requirement! :laughing:

Do you mean you got websockets working by using the espidf provided libraries? That library was added to the ESPIDF about two months ago, and was probably added too late to the last release cycle (was added about four days prior to the release) for it to make it into v3.2.2 of the ESPIDF.

btw, if you hadn’t already spotted it, you can filter the search results by framework (add framework:espidf to the search)… but that still doesn’t help as there don’t seem to be any websocket libraryies on the PlatformIO registry for ESPIDF.