Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Websocket_Client sample causes HTTP parser error: HPE_CB_headers_complete #2494

Open
gbaranski opened this issue Feb 22, 2022 · 3 comments

Comments

@gbaranski
Copy link

I'm using sample from https://github.com/SmingHub/Sming/tree/develop/samples/Websocket_Client.
Running on ESP8266 Wemos D1 Mini Board.

@slaff
Copy link
Contributor

slaff commented Feb 22, 2022

Ok, I see the problem. The websocket server that we use in the sample echo.websocket.org is no longer publicly available. Take a look at application.cpp:

https://github.com/SmingHub/Sming/blob/develop/samples/Websocket_Client/app/application.cpp#L39

and replace the websocket server URL with your own websocket server.

@gbaranski
Copy link
Author

alright that works now. Don't you think that those errors should be more readable to the user?

@mikee47
Copy link
Contributor

mikee47 commented Feb 27, 2022

alright that works now. Don't you think that those errors should be more readable to the user?

Agreed. I've had a dig into exactly what's going on here using the Simple Websocket Client plugin for firefox. These are the response headers:

HTTP/1.1 200 OK
x-amz-id-2: aDP+2nX5soleb7+lPTk6c8QMuXDvTCWpToz6IMrI9rgsw6VyWJUmQ0+kmcS9NdkbqH4OB8zZeoY=
x-amz-request-id: 2C8VTRTYZA541D4K
Date: Sun, 27 Feb 2022 13:35:37 GMT
Last-Modified: Thu, 26 Aug 2021 03:35:42 GMT
ETag: "6d5a28f4c5e297e95a29988884c9e896"
Content-Type: text/html
Server: AmazonS3
Content-Length: 4413
Connection: close

So no error, just that the Sec-WebSocket-Accept header isn't present. Running the sample application in host mode with debugger locates the point of failure and I've opened a PR so we can have a look at improving this.

In this particular instance the exact cause is only obvious by visiting http://echo.websocket.org...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants