Closed sasha-id closed 3 years ago
Here is wscat
:
Here is async-websocket
:
It looks like the host header is foobar for some reason.
Okay, so this part is now fixed by passing the authority through, but I encountered another issue:
It turns out either my implementation or the server implementation have interpreted the RFC incorrectly.
This seems... odd. The mask has no value when going over SSL/TLS and it's not documented as a "MUST" requirement so enforcing it on the server side is a bit... pedantic. Similar issue discussed here: https://github.com/containous/traefik/issues/4487#issuecomment-467170296
Okay, I found more discussion here: https://github.com/gorilla/websocket/issues/560
It turns out section 5.1 clarifies that masking is required in all cases client - server. I did not realise this.
I'm still surprised this is a requirement but I can understand if you have TLS termination -> non-TLS application, you might end up with framing issues.
That being said, this shouldn't be an issue for HTTP/2.
The cost of masking is non-zero, but I guess we have no choice but to enforce it.
Thank you for looking into this. Are you going to update your gem to make it work?
Yes, I'll provide an update shortly, now that everything is working correctly.
Thank you! 🙏
Okay, this should be fixed in v0.16.0 and you'll also need to pull the latest protocol-websocket which has some fixes.
Thank you so much, it's working! :)
Awesome, thanks for the detailed report and using the project.
Trying to make it work with polygon.io websockets API, and getting these errors, HTTP2/HTTP1: Works fine with faye-websocket-ruby and nio4r-websocket.
Please point out what I am doing wrong.
endpoint = Async::HTTP::Endpoint.parse('wss://socket.polygon.io/stocks', alpn_protocols: Async::HTTP::Protocol::HTTP11.names)
endpoint = Async::HTTP::Endpoint.parse('wss://socket.polygon.io/stocks)