-
Notifications
You must be signed in to change notification settings - Fork 170
Make sure to use HttpClient when upgrading the connection for websockets #152
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
Make sure to use HttpClient when upgrading the connection for websockets #152
Conversation
Using WebSocketClient::begin I got into problems where `status = responseStatusCode();` would be trying to read the HTTP header, but because both HttpClient and WebSocketClient have a read function, the read from WebSocketClient was used, which returns a bunch of gibberish. This caused the WebSocket to think that the connection was not successfully upgraded.
Memory usage change @ 8566fb4
Click for full report table
Click for full report CSV
|
Hi @per1234 are you still maintaining this project? |
Hi @tim-vandecasteele. Thanks for your pull request! My role in this project is janitorial. I try to help keep the issue tracker tidy and maintain the infrastructure, but am not in a role to decide on changes to the codebase. One of the other maintainers will need to take care of the review and merging of this pull request. |
Hi, sorry, I was too quick drawing conclusions from the dependabot merges. Any idea who would be a maintainer for this project then? Looking through the commits there weren't a lot of merges other than these updates in this project. Sorry to bring these questions to you, not really clear who else should be addressed 😅 |
Hi @tim-vandecasteele, I would also add ArduinoHttpClient/src/HttpClient.cpp Line 140 in 5c5fafb
|
disclaimer: I'm a bit puzzled by this problem, as everyone should have this problem but then people would have a lot of problems with websockets
Context: I'm using websockets over https, using
WiFiClientSecure
Using WebSocketClient::begin I got into problems where
status = responseStatusCode();
would be trying to read the HTTP header, but because both HttpClient and WebSocketClient have a read function, the read from WebSocketClient was used, which returns a bunch of gibberish bytes. This caused the WebSocket to think that the connection was not successfully upgraded, whereas in reality the webserver gave a proper response.this basically gave
ret = -4
, becauseresponseStatusCode
couldn't find the HTTP header.Let me know what the structure is to get things merged, or what adaptations are required.
(I tested this on a simple esp32 board)