Esp-idf: websocket client in esp-idf (IDFGH-511)

Created on 13 Dec 2018  路  10Comments  路  Source: espressif/esp-idf

Can you provide a websocket client for esp-idf and example codes. Please help me to find the supported lib and examples

Most helpful comment

Hi @tharunjoy ,

Sorry for the lack of an update on this issue. An official WebSockets client is being worked on for ESP-IDF V4.0, and this issue will be updated when it's available.

Angus

All 10 comments

Thanks for your response.
I am new to this, can you provide an example code for websocket client using this library.

I think you have first to setup a Socket connecting to your WebSocket Server.
( https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/Socket.h - use Socket::connect(..); )
At the second step you can make an instance from WebSocket with the Socket as parameter in the constructor.
I don't know how to exactly use the WebSocket because I only used the HttpServer before.
Maybe this file helps or @nkolban can provide some examples.

Hi @tharunjoy ,

Sorry for the lack of an update on this issue. An official WebSockets client is being worked on for ESP-IDF V4.0, and this issue will be updated when it's available.

Angus

FWIW, I just wrote a WebSocket client, if this is of use to anyone else: https://github.com/tricot-io/xsp
(it's currently on top of a slightly patched esp-idf v3.2).

@projectgus

I am using older esp idf version. Can I manually add this new websocket component to my older version of esp idf?

@tharunjoy You haven't said what ESP-IDF version you are currently using, but anything is possible if you are prepared to some development work yourself and support the result yourself.

I would strongly recommend waiting for ESP-IDF v4.0 release, or trying the v4.0-beta2 version, though.

@projectgus
Currently I am working on 'esptool.py v2.8-dev, 2.8-dev'. Since I am using 'Arduino over esp idf' component to support Arduino library and as this is not implemented over the latest IDF(https://github.com/espressif/arduino-esp32/issues/3201#issuecomment-530899455) version, I am forced to stick on this version.

If I download the source code for official websocket client library and add them to the my IDE version component file as an external library and add it in the component.mk file, will I be able to compile and use them?

@tharunjoy That is the esptool.py version not the ESP-IDF version, but I understand what you mean.

There is no easy way to integrate this into the IDF version used with Arduino, I'd recommend waiting for Arduino to update the IDF version. Sorry about that.

Was this page helpful?
0 / 5 - 0 ratings