Skip to content
Merged
Changes from all commits
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
64 changes: 47 additions & 17 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ A {{WebTransportDatagramsWritable}} object has the following internal slot.
</tr>
<tr>
<td><dfn>`[[Transport]]`</dfn>
<td class="non-normative">A {{WebTransport}} which owns this {{WebTransportDatagramsWritable}}.
<td class="non-normative">The {{WebTransport}} that owns this {{WebTransportDatagramsWritable}}.
</tr>
<tr>
<td><dfn>`[[SendGroup]]`</dfn>
Expand All @@ -360,6 +360,7 @@ A {{WebTransportDatagramsWritable}} object has the following internal slot.
</tbody>
</table>

<div algorithm="create writable">
To <dfn export for="WebTransportDatagramsWritable" lt="create|creating">create</dfn> a
{{WebTransportDatagramsWritable}}, given a {{WebTransport}} |transport|, a |sendGroup|,
and a |sendOrder|, perform the following steps.
Expand All @@ -379,6 +380,8 @@ A {{WebTransportDatagramsWritable}} object has the following internal slot.
set to |writeDatagramsAlgorithm|.
1. Return |stream|.

</div>

## Attributes ## {#datagram-writable-attributes}

: <dfn for="WebTransportDatagramsWritable" attribute>sendGroup</dfn>
Expand Down Expand Up @@ -504,6 +507,10 @@ A {{WebTransportDatagramDuplexStream}} object has the following internal slots.
</tr>
</thead>
<tbody>
<tr>
<td><dfn>`[[Transport]]`</dfn>
<td class="non-normative">The {{WebTransport}} that owns this {{WebTransportDatagramDuplexStream}}.
</tr>
<tr>
<td><dfn>`[[Readable]]`</dfn>
<td class="non-normative">A {{ReadableStream}} for incoming datagrams.
Expand Down Expand Up @@ -568,13 +575,14 @@ A {{WebTransportDatagramDuplexStream}} object has the following internal slots.
The user agent MAY update {{[[OutgoingMaxDatagramSize]]}} for any {{WebTransport}} object whose
{{[[State]]}} is either `"connecting"` or `"connected"`.

<div algorithm="create datagrams duplex stream">
To <dfn export for="WebTransportDatagramDuplexStream" lt="create|creating">create</dfn> a
{{WebTransportDatagramDuplexStream}} given a
<dfn export for="WebTransportDatagramDuplexStream/create"><var>readable</var></dfn> and
<dfn export for="WebTransportDatagramDuplexStream/create"><var>readableMode</var></dfn>,
perform the following steps.
{{WebTransportDatagramDuplexStream}} given a {{WebTransport}} |transport|, a
|readable| and |readableMode|, perform the following steps.

1. Let |stream| be a [=new=] {{WebTransportDatagramDuplexStream}}, with:
: {{WebTransportDatagramDuplexStream/[[Transport]]}}
:: |transport|
: {{WebTransportDatagramDuplexStream/[[Readable]]}}
:: |readable|
: {{WebTransportDatagramDuplexStream/[[ReadableMode]]}}
Expand All @@ -601,23 +609,32 @@ The user agent MAY update {{[[OutgoingMaxDatagramSize]]}} for any {{WebTransport
:: an [=implementation-defined=] integer.
1. Return |stream|.

</div>

## Methods ## {#datagram-duplex-stream-methods}

: <dfn for="WebTransportDatagramDuplexStream" method>createWritable()</dfn>
:: Creates a {{WebTransportDatagramsWritable}}.

<div algorithm="createWritable">
When `createWritable()` method is called, the user agent MUST
run the following steps:
1. Let |transport| be {{WebTransport}} object associated with [=this=].
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`,
[=throw=] an {{InvalidStateError}}.
1. Let |sendGroup| be {{WebTransportDatagramDuplexStream/createWritable(options)/options}}'s
{{WebTransportSendOptions/sendGroup}}.
1. If |sendGroup| is not null, and
|sendGroup|.{{WebTransportSendGroup/[[Transport]]}} is not
[=this=].{{WebTransportDatagramDuplexStream/[[Transport]]}}, [=throw=]
an {{InvalidStateError}}.
1. Let |sendOrder| be {{WebTransportDatagramDuplexStream/createWritable(options)/options}}'s
{{WebTransportSendOptions/sendOrder}}.
1. Return the result of [=WebTransportDatagramsWritable/creating=] a {{WebTransportDatagramsWritable}}
with |transport|, |sendGroup| and |sendOrder|.

</div>

## Attributes ## {#datagram-duplex-stream-attributes}

: <dfn for="WebTransportDatagramDuplexStream" attribute>readable</dfn>
Expand Down Expand Up @@ -910,9 +927,6 @@ agent MUST run the following steps:
1. Let |datagramsReadableMode| be {{WebTransport/constructor(url, options)/options}}'s
{{WebTransportOptions/datagramsReadableMode}}.
1. Let |incomingDatagrams| be a [=new=] {{ReadableStream}}.
1. Let |datagrams| be the result of [=WebTransportDatagramDuplexStream/creating=] a
{{WebTransportDatagramDuplexStream}}, its [=WebTransportDatagramDuplexStream/create/readable=] set to
|incomingDatagrams| and [=WebTransportDatagramDuplexStream/create/readableMode=] set to |datagramsReadableMode|.
1. Let |transport| be a newly constructed {{WebTransport}} object, with:
: {{[[SendStreams]]}}
:: an empty [=ordered set=]
Expand Down Expand Up @@ -941,7 +955,7 @@ agent MUST run the following steps:
: {{[[Draining]]}}
:: a new promise
: {{[[Datagrams]]}}
:: |datagrams|
:: undefined
: {{[[Session]]}}
:: null
: {{[[NewConnection]]}}
Expand All @@ -950,6 +964,9 @@ agent MUST run the following steps:
:: |requireUnreliable|
: {{[[ServerCertificateHashes]]}}
:: |serverCertificateHashes|
1. Set |transport|.{{[[Datagrams]]}} to the result of [=WebTransportDatagramDuplexStream/creating=]
a {{WebTransportDatagramDuplexStream}}, with |transport|, |incomingDatagrams| and
|datagramsReadableMode|.
1. Let |pullDatagramsAlgorithm| be an action that runs [=pullDatagrams=] with |transport|.

Note: Using 64 kibibytes buffers with datagrams is recommended because the effective
Expand Down Expand Up @@ -1274,19 +1291,22 @@ the application will receive the number of streams it anticipates.

Note: There is no expectation that the server will be aware of the stream until data is sent on it.

<div algorithm="createBidirectionalStream">
When `createBidirectionalStream` is called, the user agent MUST run the
following steps:

1. Let |transport| be [=this=].
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`,
1. If [=this=].{{[[State]]}} is `"closed"` or `"failed"`,
return a new [=rejected=] promise with an {{InvalidStateError}}.
1. Let |sendGroup| be {{WebTransport/createBidirectionalStream(options)/options}}'s
{{WebTransportSendOptions/sendGroup}}.
1. If |sendGroup| is not null, and |sendGroup|.{{WebTransportSendGroup/[[Transport]]}}
is not [=this=], [=throw=] an {{InvalidStateError}}.
1. Let |sendOrder| be {{WebTransport/createBidirectionalStream(options)/options}}'s
{{WebTransportSendOptions/sendOrder}}.
1. Let |waitUntilAvailable| be {{WebTransport/createBidirectionalStream(options)/options}}'s
{{WebTransportSendStreamOptions/waitUntilAvailable}}.
1. Let |p| be a new promise.
1. Let |transport| be [=this=].
1. Run the following steps [=in parallel=], but [=abort when=] |transport|'s
{{[[State]]}} becomes `"closed"` or `"failed"`, and instead
[=queue a network task=] with |transport| to [=reject=] |p| with an {{InvalidStateError}}:
Expand All @@ -1307,6 +1327,8 @@ the application will receive the number of streams it anticipates.
1. [=Resolve=] |p| with |stream|.
1. Return |p|.

</div>

: <dfn for="WebTransport" method>createUnidirectionalStream()</dfn>

:: Creates a {{WebTransportSendStream}} for an outgoing unidirectional stream. Note
Expand All @@ -1315,18 +1337,22 @@ the application will receive the number of streams it anticipates.

Note: There is no expectation that the server will be aware of the stream until data is sent on it.

<div algorithm="createUnidirectionalStream">
When `createUnidirectionalStream()` method is called, the user agent MUST
run the following steps:
1. Let |transport| be [=this=].
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`,
1. If [=this=].{{[[State]]}} is `"closed"` or `"failed"`,
return a new [=rejected=] promise with an {{InvalidStateError}}.
1. Let |sendGroup| be {{WebTransport/createUnidirectionalStream(options)/options}}'s
{{WebTransportSendOptions/sendGroup}}.
1. If |sendGroup| is not null, and
|sendGroup|.{{WebTransportSendGroup/[[Transport]]}} is not [=this=], [=throw=]
an {{InvalidStateError}}.
1. Let |sendOrder| be {{WebTransport/createUnidirectionalStream(options)/options}}'s
{{WebTransportSendOptions/sendOrder}}.
1. Let |waitUntilAvailable| be {{WebTransport/createUnidirectionalStream(options)/options}}'s
{{WebTransportSendStreamOptions/waitUntilAvailable}}.
1. Let |p| be a new promise.
1. Let |transport| be [=this=].
1. Run the following steps [=in parallel=], but [=abort when=] |transport|'s
{{[[State]]}} becomes `"closed"` or `"failed"`, and instead
[=queue a network task=] with |transport| to [=reject=] |p| with an {{InvalidStateError}}:
Expand All @@ -1347,16 +1373,20 @@ the application will receive the number of streams it anticipates.
1. [=Resolve=] |p| with |stream|.
1. return |p|.

</div>

: <dfn for="WebTransport" method>createSendGroup()</dfn>

:: Creates a {{WebTransportSendGroup}}.

<div algorithm="createSendGroup">
When `createSendGroup()` method is called, the user agent MUST
run the following steps:
1. Let |transport| be [=this=].
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`,
1. If [=this=].{{[[State]]}} is `"closed"` or `"failed"`,
[=throw=] an {{InvalidStateError}}.
1. Return the result of [=WebTransportSendGroup/creating=] a {{WebTransportSendGroup}} with |transport|.
1. Return the result of [=WebTransportSendGroup/creating=] a {{WebTransportSendGroup}} with [=this=].

</div>

## Procedures ## {#webtransport-procedures}

Expand Down Expand Up @@ -1912,7 +1942,7 @@ A {{WebTransportSendStream}} has the following internal slots.
</tr>
<tr>
<td><dfn>`[[Transport]]`</dfn>
<td class="non-normative">A {{WebTransport}} which owns this {{WebTransportSendStream}}.
<td class="non-normative">The {{WebTransport}} that owns this {{WebTransportSendStream}}.
</tr>
<tr>
<td><dfn>`[[SendGroup]]`</dfn>
Expand Down