Add WebTransport over HTTP/3 support#341
Draft
reecelikesramen wants to merge 2 commits intopgjones:mainfrom
Draft
Add WebTransport over HTTP/3 support#341reecelikesramen wants to merge 2 commits intopgjones:mainfrom
reecelikesramen wants to merge 2 commits intopgjones:mainfrom
Conversation
Contributor
|
Finally someone implemented it.... I wrote another |
Author
|
I would really appreciate it if you could check my work, given you made your own implementation too |
Contributor
|
Sure, I'll have a look when I'm free |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for WebTransport over HTTP/3. It's intended to support the low-latency bi-directional communication needed for real-time apps.
The implementation introduces a
WebTransportSessionclass inh3.pyto manage the lifecycle. It handles the initial CONNECT request, translates headers into thewebtransportASGI scope, and manages the data flow for both streams and datagrams.I had to update
H3Protocolto bypass theH3Connectionstate machine when sending data on WebTransport streams. Since these are raw QUIC streams, the standard H3 state machine was getting confused and throwing assertions. Going directly to the underlying QUIC connection resolves this since we don't need the HTTP/3 framing here.It's currently an opt-in feature via
enable_webtransport = Truein the config, all explained in the docs.I added this in order to support and tested this with an interactive server project I'm working on. When testing this on localhost, you need to generate ephemeral certs and use a Chrome flag to force QUIC on host localhost. Let me know if you need more details.