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

Spec for WebTransport in ASGI #280

Open
jlaine opened this issue Jul 9, 2021 · 7 comments
Open

Spec for WebTransport in ASGI #280

jlaine opened this issue Jul 9, 2021 · 7 comments

Comments

@jlaine
Copy link
Contributor

jlaine commented Jul 9, 2021

With QUIC standardisation complete (RFC 9000) and HTTP/3 nearing completion, a new spec is shaping up: WebTransport:

https://w3c.github.io/webtransport/
https://datatracker.ietf.org/doc/html/draft-vvv-webtransport-http3

This specification revolves around a "session" initiated by the client over an HTTP3 connection by means of a CONNECT method to a give path/authority. The session then provides:

  • bidirectional streams (similar to WebSockets, but there can be more than one per session)
  • unidirectional streams
  • datagrams for message-oriented communications

I am currently working on integrating WebTransport support in aioquic, my QUIC/HTTP3 stack, so hypercorn could very soon have support for WebTransport (hi @pgjones).

See: aiortc/aioquic#204

It would be great if there was a standardised API for Python web apps to leverage this, so I'd love us to start the discussion!

@andrewgodwin
Copy link
Member

Gosh, that's a lot of spec to cover. I think a good first move here would be to implement a prototype server and play with the message format a bit until it starts to feel alright to write apps against? That's what I did with HTTP and WebSocket.

@jlaine
Copy link
Contributor Author

jlaine commented Jul 10, 2021

Sounds good, I'll do exactly that. The aioquic repository already features a basic HTTP/3 server which can run ASGI apps, I'll tack on a WebTransport demo.

@jlaine
Copy link
Contributor Author

jlaine commented Jul 10, 2021

Maybe @bashi has some insights here in light of the specification work done for the Web Platform Tests?

@bashi
Copy link

bashi commented Jul 11, 2021

Unfortunately I haven't explored integration with wsgi/asgi when I prototyped a WebTransport over HTTP/3 server for WPT. This is mostly because wptserve has a design goal which gives test authors control of the exact bytes sent over the wire and their timing (See: introduction).

Current proposed WPT APIs for WebTransport over HTTP/3 can be found here. I plan to update the proposed APIs once @jlaine's work has done.

@jlaine
Copy link
Contributor Author

jlaine commented Jul 13, 2021

I have started putting together a demo WebTransport server with an "extended" ASGI implementation. So far the new messages I have are:

Server => ASGI app

  • webtransport.connect : equivalent to websocket.connect, it expects a reply of type webtransport.accept or webtransport.close to accept or reject the CONNECT request
  • webtransport.datagram.receive : informs the ASGI app that a datagram was received. The payload is in message["data"]
  • webtransport.stream.receive : informs the ASGI app that stream data was received. The payload is in message["data"], and the stream identifier in message["stream"]

ASGI app => server

  • webtransport.accept : accept the WebTransport session
  • webtransport.close : reject or end the WebTransport session
  • webtransport.datagram.send : send a datagram. The payload is in message["data"]
  • webtransport.stream.send : send stream data. The payload is in message["data"], and the stream identifier in message["stream"]

@guest271314
Copy link

when I prototyped a WebTransport over HTTP/3 server for WPT

Is the server code published on GitHub?

@jlaine
Copy link
Contributor Author

jlaine commented Jul 22, 2021

Is the server code published on GitHub?

Yes, the http3_server.py provided with aioquic includes the WebTransport demo, and I've provided some instructions on how to use it in aiortc/aioquic#163

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

4 participants