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

Add Http3Transport #7

Merged
merged 4 commits into from
May 15, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,16 @@ async function readStreamUntilFin(stream) {
}
```

## Example of requesting over HTTP and receiving media pushed out-of-order and unreliably over the same network connection
## Example of requesting over pooled HTTP and receiving media pushed out-of-order and unreliably over the same network connection

```javascript
const mime = 'video/webm; codecs="opus, vp09.00.10.08"';
const mediaSource = new MediaSource();
mediaSource.onsourceopen = (e) => {
const sourceBuffer = mediaSource.addSourceBuffer(mime);

const transport = PooledHttpTransport.getDatagramTransport();
if (transport) {
await fetch('http://example.com/babyshark');
const transport = new Http3Transport("/video");
while (transport.state == "connecting" || transport.state == "connected") {
const datagrams = await transport.receiveDatagrams();
for (let data of datagrams) {
if (data) {
Expand All @@ -230,6 +229,22 @@ mediaSource.onsourceopen = (e) => {
};
```

## Example of requesting over HTTP and receiving media pushed out-of-order and reliably over the same network connection

```javascript
const mime = 'video/webm; codecs="opus, vp09.00.10.08"';
const mediaSource = new MediaSource();
mediaSource.onsourceopen = (e) => {
const sourceBuffer = mediaSource.addSourceBuffer(mime);

const transport = new Http3Transport("https://example.com/video");
transport.onunidirectionalstream = (e) => {
const chunk = await readStreamUntilFin(e.stream);
sourceBuffer.appendBuffer(chunk);
}
};
```

## Detailed design discussion

Any WebTransport can provide any of the following capabilities (mixins):
Expand All @@ -253,10 +268,11 @@ A QuicTransport is a WebTransport that maps directly to QUIC streams and
datagrams, which makes it easy to connect to servers that speak QUIC with
minimum overhead. It supports all of these capabilities.

A PooledHttpTransport is a WebTransport that provides different subset of these
capabilities depending on the underlying HTTP protocol (HTTP/3 providing the
widest support). It has the advantages that HTTP and non-HTTP traffic can share
the same network port and congestion control context.
An Http3Transport is a WebTransport that provides QUIC streams and datagrams
with slightly more overhead vs. a QuicTransport. It has the advantage that HTTP
and non-HTTP traffic can share the same network port and congestion control
context, and it may be pooled with other transports such that the transport may
be connected more quickly (by resuing an existing HTTP/3 connection).
pthatcherg marked this conversation as resolved.
Show resolved Hide resolved

## Alternative designs considered

Expand Down
7 changes: 7 additions & 0 deletions include/respec-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ var respecConfig = {
"status": "11 March 2019. Internet draft (work in progress)",
"publisher": "IETF"
},
"WEB-TRANSPORT-HTTP3": {
"title": "WebTransport over HTTP/3"
"href": "https://tools.ietf.org/html/draft-vvv-webtransport-http3-00",
"authors": [
"V. Vasiliev"
]
}
"TLS13": {
"title": "The Transport Layer Security (TLS) Protocol Version 1.3",
"href": "https://tools.ietf.org/html/rfc8446",
Expand Down
123 changes: 121 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ <h2>Methods</h2>
</section>
</section>

<section id="data-transport*">
<section id="web-transport*">
<h2><dfn>WebTransport</dfn> Mixin</h2>
<p>
The <code>WebTransport</code> includes the methods common to all transports,
Expand Down Expand Up @@ -1743,7 +1743,7 @@ <h2>Dictionary <a class="idlType">StreamReadResult</a> Members</h2>
</div>
</section>

<section id="data-transport-stream*">
<section id="web-transport-stream*">
<h2>Interface <dfn>WebTransportStream</dfn></h2>
<p>A collection of common attributes and methods of all streams.</p>
<div>
Expand Down Expand Up @@ -1811,6 +1811,125 @@ <h3>Interface <dfn>ReceiveStream</dfn></h3>
</div>
</section>

<section id="http3-transport*">
<h2><dfn>Http3Transport</dfn> Interface</h2>
<p>The <code>Http3Transport</code> is ***
</p>
<section id="http3-transport-overview*">
<h3>Overview</h3>
<p>An <code><a>Http3Transport</a></code> is a
<code>UnidirectionalStreamsTransport</code>, a
<code>BidirectionalStreamsTransport</code>, and a
<code>DatagramTransport</code>.
SendStreams, ReceiveStreams, and BidirectionalStreams are implemented with
HTTP/3 streams as defined in [[WEB-TRANSPORT-HTTP3]]. Datagrams are
implemented with QUIC datagrams as defined in [[WEB-TRANSPORT-HTTP3]].
</p>
</section>
<section id="http3-transport-interface-definition*">
<h3>Interface Definition</h3>
<div>
<pre class="idl">
[ Constructor (DOMString url), Exposed=Window]
interface Http3Transport {
};

Http3Transport includes UnidirectionalStreamsTransport;
Http3Transport includes BidirectionalStreamsTransport;
Http3Transport includes DatagramTransport;
Http3Transport includes WebTransport;</pre>
</div>
<section>
<h2>Constructors</h2>
When the <code><a>Http3Transport</a></code> constructor is invoked,
the user agent <em class="rfc2119" title="MUST">MUST</em> run the
following steps:
<ol>
<li>
Let <var>transport</var> be a newly constructed
<code><a>Http3Transport</a></code> object with state "connecting".
</li>
<li>Let <var>transport</var> have a <dfn>[[\OutgoingStreams]]</dfn>
internal slot representing a sequence of <code><a>OutgoingStream</a></code>
objects, initialized to empty.
</li>
<li>Let <var>transport</var> have a <dfn>[[\IncomingStreams]]</dfn>
internal slot representing a sequence of <code><a>IncomingStream</a></code>
objects, initialized to empty.
</li>
<li>
Let <var>transport</var> have a <dfn>[[\WebTransportState]]</dfn>
internal slot, initialized to <code>"connecting"</code>.
pthatcherg marked this conversation as resolved.
Show resolved Hide resolved
</li>
<li>Let <var>transport</var> have a <dfn>[[\ReceivedDatagrams]]</dfn>
internal slot representing a queue of <code>Uint8Array</code>, initialized to empty.
</li>
<li>Let <var>transport</var> have a <dfn>[[\ReceiveDatagramsPromise]]</dfn>
pthatcherg marked this conversation as resolved.
Show resolved Hide resolved
internal slot representing a <code>Promise&lt;sequence&lt;Uint8Array&gt;&gt;?</code>,
initialized to null.
<li>Run these steps in parallel:
<ol>
<li>
Either establish an HTTP/3 connection or reuse an existing HTTP/3
pthatcherg marked this conversation as resolved.
Show resolved Hide resolved
connection to the host specificed by the url.
</li>
<li>
If there is no such HTTP/3 connection to reuse and the establishment of a
new HTTP/3 connection, set <var>transport</var>'s <a>[[\WebTransportState]]</a>
internal slot to <code>"failed"</code> and abort these steps.
</li>
<li>
Once a connection an HTTP/3 connection is established, follow the
steps specified in [[WEB-TRANSPORT-HTTP3]] section 4 for
establishing a WebTransport session within the HTTP/3 connection.
</li>
<li>
If the establishment of the WebTransport session fails,
set <var>transport</var>'s <a>[[\WebTransportState]]</a>
internal slot to <code>"failed"</code> and abort these steps.
</li>
<li>
Once a session has been established, set <var>transport</var>'s
<a>[[\WebTransportState]]</a> internal slot to <code>"connected"</code>
and abort these steps.
</li>
</ol>
</li>
<li>
Return <var>transport</var>.
</li>
</ol>
<dl data-link-for="Http3Transport" data-dfn-for="Http3Transport" class=
"constructors">
<dt><code><a>Http3Transport</a></code></dt>
<dd>
<table class="parameters">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Nullable</th>
<th>Optional</th>
<th>Description</th>
</tr>
<tr>
<td class="prmName">url</td>
<td class="prmType"><code><a>DOMString</a></code></td>
<td class="prmNullFalse"><span role="img" aria-label=
"False">&#10008;</span></td>
<td class="prmOptFalse"><span role="img" aria-label=
"False">&#10008;</span></td>
<td class="prmDesc">The url specifying the host to connect to and the path to pass to it.</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</section>
</div>
</section>
</section>

<section id="privacy-security">
<h2>Privacy and Security Considerations</h2>
<p>This section is non-normative; it specifies no new behaviour, but
Expand Down