Skip to content
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

WebTransport support #1114

Open
notedit opened this issue Dec 11, 2021 · 17 comments
Open

WebTransport support #1114

notedit opened this issue Dec 11, 2021 · 17 comments

Comments

@notedit
Copy link

notedit commented Dec 11, 2021

Hi, Chrome M97 will support WebTransport( https://chromestatus.com/roadmap ),
Does quiche support WebTransport or will support WebTransport?

@kalradivyanshu
Copy link

kalradivyanshu commented Dec 11, 2021

Chrome has a webserver sample that uses python3 and aioquic to support WebTransport (https://github.com/GoogleChrome/samples/tree/gh-pages/webtransport). Would be great if quiche could support webtransport, or if someone could guide me on how to use quiche to build a WebTransport server.

@LPardue
Copy link
Contributor

LPardue commented Dec 14, 2021

Hey.

Here's been a few iterations of the WebTransport protocol, I expect that to keep happening while the details are all figured out in the IETF. So the question is, what version are you targeting?

I'd guess its the version of WebTransport over HTTP/3 that's based on https://datatracker.ietf.org/doc/html/draft-ietf-masque-h3-datagram-05, which changes the QUIC DATAGRAM format from what we have implemented today in quiche. And that format is likely to change again in the near future due to IETF work. The good news is that as a workaround, you can add context ID handling in application space without needing any changes in quiche.

The rest of WebTransport is also mostly the responsibility of applications using quiche. I have an old branch that implemented an echo service using QuicTransport (now long deprecated) on client and server in about additional 450 lines. I suspect similar changes would be needed to add WebTransport over HTTP/3, although I think it would be simpler than my branch because you don't have to define an entirely new ALPN handler (just reuse HTTP/3).

The main challenge you'll have to implementing WebTransport though is handling the Capsule protocol, which requires variable-length integer handling. quiche's internal code for handling this, octets, is not currently public. For experimentation you could force that in fork, or just reimplement it.

@notedit
Copy link
Author

notedit commented Dec 15, 2021

@LPardue Thanks,I will check your QuicTransport branch. I did not know the Chrome's WebTransport version yet, Maybe the version with the M97.

@alishir
Copy link
Contributor

alishir commented Mar 29, 2022

@LPardue Thanks for the detailed explanation. According to the last paragraph in your above answer, you said that octets is a private crate, but there is octets.rs in the quiche source tree. Does the octets.rs in the source tree differ from the octets package in your answer?

@LPardue
Copy link
Contributor

LPardue commented Apr 8, 2022

Octets is now available as a crate in https://crates.io/crates/octets

@alishir
Copy link
Contributor

alishir commented Apr 8, 2022

Thanks a lot.

@danielblignaut
Copy link

+1 . Can anybody share an example of this if they've managed to implement it.

@btwiuse
Copy link

btwiuse commented Oct 6, 2022

+1 . Can anybody share an example of this if they've managed to implement it.

xflagstudio/requiem is using a forked quiche with webtransport support:

https://github.com/lyokato/quiche/commits/0.12.0-webtransport-support

@danielblignaut
Copy link

@btwiuse I've seen that but it seems incomplete? I get compile time errors in the Rust code

@D1plo1d
Copy link

D1plo1d commented Nov 8, 2022

@danielblignaut I'm running their example without compile errors (although I haven't figured out how to connect a client yet). In order to get a successful compile I ran:

git clone https://github.com/lyokato/quiche.git
cd quiche/quiche
git checkout 0.12.0-webtransport-support
git submodule init
git submodule update
cargo run --example http3-server

For reference this is the example I'm running:
https://github.com/lyokato/quiche/blob/0.12.0-webtransport-support/quiche/examples/http3-server.rs

Edit: examples/http3-server does not support Web Transport. See my comment bellow for a working solution.

@D1plo1d
Copy link

D1plo1d commented Nov 9, 2022

After a bit of trial and error I've gotten a Web Transport connection from Quiche to Chrome to send and receive data:
https://github.com/D1plo1d/quiche/blob/webtransport-example/quiche/examples/webtransport-server.rs

The pull request to merge this into the webtransport branch can be found here: lyokato#1

With regards to my setup, I'm using Chrome version 106.0.5249.119 (a recent release)

PS. For anyone coming across this later examples/http3-server I mentioned earlier does not support WebTransport. Use my examples/webtransport-server example to connect WebTransport sessions.

@ayasuda-may
Copy link

PS. For anyone coming across this later examples/http3-server I mentioned earlier does not support WebTransport. Use my examples/webtransport-server example to connect WebTransport sessions.

Those of us have similar needs, this branch is actively maintained, adding extra supports such as ffi based on the latest draft. The goal is to compile a final version to PR the original when the requirement is met.

Thanks but the working branch seems to be outdated (0.12.0). Please kindly help us to test, or rather PR this branch if it seems fitting @D1plo1d

@D1plo1d
Copy link

D1plo1d commented Nov 26, 2022

@mayniacs I've not been able to get a WebTransport connection to Chrome working with your branch so far - I am by no means an expert on Quic though. Would it be possible for you to add an example that demonstrates how to accept WebTransport connections?

@n8o
Copy link

n8o commented Mar 17, 2023

I took the WebTransport implementation from lyokato and example from @D1plo1d merged them together and rebased it on top of master in cloudflare/quiche. I originally wasn't going to update it to master. I needed c/c++ support so i added ffi support. But it turns out that sockaddr in rust changed recently and i either needed to port the updated code from master to the older version or rebase it on master. so i went ahead and rebased it.

I didn't look at ayasuda-may/quiche implementation because of the above comments about the example not working. also the ffi stuff was incomplete imo.

This is my first time writing rust code so I haven't created a PR yet. Any help or advice would be appreciated.

List of changes:

  • Added WT support based from lyokato
  • Added WT example from D1plo1d
  • Added WT ffi
  • Fixed Unit Tests
  • Tested only WT example and passed.

You can view the changes here:
https://github.com/n8o/quiche

@redoriental
Copy link

https

I used your branch, but it seems to be unable to trigger connection closure and flow closure

@n8o
Copy link

n8o commented Feb 11, 2024

Can you create an example I can test against?

@brentmjohnson
Copy link

@n8o just tried your implementation and all tests defined in webtransport-server-public passed on edge v126 - excited to start experimenting! thanks to all others that have contributed as well.

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

No branches or pull requests