What's wrong with this websocket response? (Error read response for Upgrade header)

RichPiano
Posts: 123
Joined: Mon May 18, 2020 2:51 pm

What's wrong with this websocket response? (Error read response for Upgrade header)

Postby RichPiano » Fri Mar 04, 2022 7:10 am

I'm using the example provided in examples/protocols/websocket to connect to my node.js/socket.io webserver. The websocket module and its associated transport_ws.c however is complaining that it can't read the following http header:

Code: Select all

E (531690) TRANSPORT_WS: Error read response for Upgrade header GET / HTTP/1.1
Connection: Upgrade
Host: <host_censored>:<port_censored>
User-Agent: ESP32 Websocket Client
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: fgofZlF6LAlrSHN8N17X+A==
The header looks valid to me and it also works perfectly with my test javascript socket.io client. Digging down in the code, it seems that the transport_ws.c module issues this error when a deeper call to transport.c's esp_transport_read fails:

Code: Select all

int esp_transport_read(esp_transport_handle_t t, char *buffer, int len, int timeout_ms)
{
    if (t && t->_read) {
        return t->_read(t, buffer, len, timeout_ms);
    }
    return -1;
}
Do I maybe have to adapt my read function?

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: What's wrong with this websocket response? (Error read response for Upgrade header)

Postby ESP_YJM » Mon Mar 07, 2022 3:23 am

You can print errno number value and capture the websocket connection packet.

RockSmoke
Posts: 4
Joined: Thu Dec 08, 2022 12:11 pm

Re: What's wrong with this websocket response? (Error read response for Upgrade header)

Postby RockSmoke » Mon Dec 12, 2022 8:34 am

i am getting the same error. how did you solve this problem

Who is online

Users browsing this forum: No registered users and 61 guests