GeezerVison is showing github.com — Websocket over HTTP2 · Issue #8011 · netty/netty
Websocket over HTTP2 #8011DescriptionHi, as per https://www.chromestatus.com/feature/6251293127475200 (think Firefox is looking into this too) is an enhancements to have Websockets served over HTTP2. Can this feature please be implemented?
https://tools.ietf.org/id/draft-mcmanus-httpbis-h2-websockets-00.html
Extracting the justification:
A server offering both HTTP/1.1 and WebSocket services can do so from the same instance and same port although they require separate TCP connections. Moving a server to HTTP/2 and WebSocket services requires a separate port and protocol stack for the sole purpose of bootstrapping WebSockets. This is a significant administrative burden and may not even be possible in the case of large amounts of deployed markup pointing at the old single name and port. Being able to bootstrap WebSockets from HTTP/2 allows one server, one port, and one TCP connection to be shared by both protocols. Reacted by KC, Thayne McCombs, Yakiv Yereskovskyi, marcel-sebek-dbag and He-Pin(kerr) Activitynormanmaurer commented on Jun 13, 2018 @hc-codersatlas we love contributions that said its a draft 00 so maybe a bit early for it. rschmitt commented on Jul 28, 2018 The latest draft of the spec is available here. seamlik commented on Jan 20, 2019
(think Firefox is looking into this too)
Will be supported by Firefox 65. rnd4222 commented on May 22, 2019 Given that it is no longer a draft, is there any chances it would be implemented in netty? normanmaurer commented on May 22, 2019 @rnd4222 we love contributions... so if you feel you have the cycles go ahead. I am not sure when I will have time to look into it. infoLightspace commented on Nov 7, 2019 Am up for the challenge. Am going through the draft. mostroverkhov commented on Jul 30, 2020 riyafa commented on Jan 31, 2022 glennosss commented on Apr 30, 2022 I recently implemented this, surprisingly with minimal effort. The hardest part of implementing was interestingly more due to how the current Websocket over HTTP/1 code was structured.
Current websocket code needs refactoring
The current Websocket over HTTP/1 code is overly coupled to HTTP/1 HttpRequest/etc.
It's fairly straight forward to separate the Websocket code so that it's separate from the HTTP/1 and HTTP/2 specific parts.
Websockets over HTTP/2
The first pull request someone should send in is simply to add;
public static final char SETTINGS_ENABLE_CONNECT_PROTOCOL = 8; to Http2CodecUtil
- update
Http2Settings to support this constant.
Adding this constant is the first step to adding Websocket over HTTP/2 support to netty. And if the previous refactoring is done, and some example code was provided, I don't think most people would have trouble enabling HTTP/2 websockets themselves.
The weirdest thing I found about Websockets over HTTP/2 is Chrome only establishes them if there's a current HTTP/2 connection it can multiplex over. If the server restarts or Chrome loses it's connection to the webserver, then Chrome will immediately (and annoyingly) default back to a HTTP/1 websocket connection. This means you must have a websocket server that also supports at least one HTTP request in order to support HTTP/2 websockets (further support for the argument that you shouldn't "optimistically setup your pipelines"). glennosss commented on May 1, 2022 @normanmaurer I'm recommending that two new incubator projects be created and wanted your thoughts.
Summary;
Ultimately in the future clients will prefer to connect using WebTransport (only supported by HTTP/3 for now), but fall back to Websockets if necessary.
I think the following repos should be created;
Current state
[netty-codec-http] contains "io.netty.handler.codec.http.websocketx" package.
Future state: netty-incubator-codec-websockets
[netty-codec-websockets-http1] initially containing copy of "io.netty.handler.codec.http.websocketx" package.
[netty-codec-websockets-http2]
[netty-codec-websockets-http3]
[netty-codec-websockets-common] Most of the code for WebSocketFrame's/etc will be moved here. But with no dependency on netty-codec-http, netty-codec-http2 or netty-codec-http3.
Eventually remove "io.netty.handler.codec.http.websocketx" package from netty-codec-http.
Future state: netty-incubator-codec-webtransport
[netty-codec-webtransport-http2]
[netty-codec-webtransport-http3]
[netty-codec-webtransport-common] KingMob commented on Oct 16, 2023 Reacted by clayly and Yakiv Yereskovskyi clayly commented on Dec 16, 2023 We've also been seeing a trend of more 400 errors lately, perhaps clients are trying http2.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|