Skip to content

Conversation

@reecelikesramen
Copy link

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 WebTransportSession class in h3.py to manage the lifecycle. It handles the initial CONNECT request, translates headers into the webtransport ASGI scope, and manages the data flow for both streams and datagrams.

I had to update H3Protocol to bypass the H3Connection state 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 = True in 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.

@synodriver
Copy link
Contributor

Finally someone implemented it.... I wrote another
here but afraid it would never be merged so I didn't make a pr for that, maybe it's the time

@reecelikesramen
Copy link
Author

I would really appreciate it if you could check my work, given you made your own implementation too

@synodriver
Copy link
Contributor

Sure, I'll have a look when I'm free

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants