I am using the ESP32 websocket client (idf version v4.2-dev-701-g0ae960f2f-dirty) to connect to a linux box running a libwebsocket server. The server side sends out a JSON formatted message immediately after a new client connects. Other clients are receiving this message just fine, but the ESP32 ws client seems to miss the first message most of the time.
If I add a delay of 100 ms to the server (between connect and the message transmission), ESP32 gets the message most of the time. With a 250 ms delay, ESP32 gets 99.8% of the messages.
Is this a known bug in the ws client implementation? Does a fix exist?
EDIT: I updated to idf version v4.2-dev-1266-g2dc4bfe78-dirty, but the problem remains the same.
Thanks!
ESP32 websocket client misses first received message
-
- Posts: 2
- Joined: Sat Jan 30, 2021 9:46 am
Re: ESP32 websocket client misses first received message
Did you find any solution?
I am also facing same problem.
I am also facing same problem.
Re: ESP32 websocket client misses first received message
I believe the bug was not in lws but in Ethernet code and I think it has been fixed a long time ago. I'm not seeing any problems with Ethernet (running idf 4.4.6), but I'm not using lws in my current projects.
Which idf version are you using?
Which idf version are you using?
-
- Posts: 2
- Joined: Sat Jan 30, 2021 9:46 am
Re: ESP32 websocket client misses first received message
I am using idf 5.0.0
Whenever a websocket is connected to a server, the server sends some JSON data with the connection, but on esp side, I didn't get that.
I tried to `esp_websocket_client_start` and `esp_websocket_client_stop` websocket_client until I didn't receive that data.
but it is working after several tries (sometime works on two try, some time 10 or above and some time takes 10 minutes or more)
Re: ESP32 websocket client misses first received message
Issue still exists. My current workaround is to add a delay on my Python server before sending any messages since the first message gets dropped on the ESP32.
Re: ESP32 websocket client misses first received message
One case seems to be if the server responds over HTTP during the protocol change: https://github.com/espressif/esp-protocols/issues/396
If you have control of the server, you may try to delay sending to the client until the protocol change to websocket is completed.
If you have control of the server, you may try to delay sending to the client until the protocol change to websocket is completed.
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot] and 109 guests