-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
proposal: x/net/http2: support http.Hijacker #46319
Comments
The WebSockets over HTTP/2 do not take over the TCP connection. Instead, the WebSocket protocol runs over an HTTP/2 stream. HTTP/2 permits multiple simultaneous streams on a TCP connection. HTTP/2 WebSockets need a way to read from and write to the HTTP/2 stream for a request, not a way to hijack the connection. |
So a new type of interface, of exposing something like a TCP connection on top of HTTP/2? Maybe I should rename this issue then to "support for WebSockets over HTTP/2". :-) |
Talking to @bradfitz, it sounds like the HTTP/2 + WebSockets is defined in RFC 8441. And as @neild pointed out, it doesn't need to use Hijacker. So it seems like we should decline this proposal and add explicit WebSockets support instead. It sounds like the latest Chrome (and presumably Edge) have support, as does Firefox, but perhaps not Safari. |
This proposal has been added to the active column of the proposals project |
Based on the discussion above, this proposal seems like a likely decline. |
Just to be clear, should I open a new issue for "support for WebSockets over HTTP/2" or rename the title of this one? |
@mitar Please open a new issue to avoid confusion. Thanks. |
I have made #49918 as a followup to this issue. |
No change in consensus, so declined. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What did you do?
I wanted to use Websockets over HTTP2.
What did you expect to see?
That HTTP2 ResponseWriter supports Hijacker.
What did you see instead?
That it does not. Exploring this more, it looks like it is on purpose:
But since then, WebSockets over HTTP2 have been standardized and Firefox and Chromium supports that. Thus, I suggest that now HTTP2 ResponseWriter should supports Hijacker so that one can use Websockets over HTTP2. The server should also be able to specify using HTTP/2 SETTINGS parameter that it supports Websockets over HTTP2.
The text was updated successfully, but these errors were encountered: