diff --git a/index.bs b/index.bs index d5a97d7..aac3805 100644 --- a/index.bs +++ b/index.bs @@ -620,6 +620,7 @@ interface WebTransport { optional WebTransportSendStreamOptions options = {}); /* a ReadableStream of WebTransportReceiveStream objects */ readonly attribute ReadableStream incomingUnidirectionalStreams; + WebTransportSender createSender(); }; enum WebTransportReliabilityMode { @@ -1001,6 +1002,8 @@ these steps. 1. Let |transport| be [=this=]. 1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, return a new [=rejected=] promise with an {{InvalidStateError}}. + 1. Let |sender| be {{WebTransport/createBidirectionalStream(options)/options}}'s + {{WebTransportSendStreamOptions/sender}}. 1. Let |sendOrder| be {{WebTransport/createBidirectionalStream(options)/options}}'s {{WebTransportSendStreamOptions/sendOrder}}. 1. Let |p| be a new promise. @@ -1015,7 +1018,7 @@ these steps. 1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, [=reject=] |p| with an {{InvalidStateError}} and abort these steps. 1. Let |stream| be the result of [=BidirectionalStream/creating=] a - {{WebTransportBidirectionalStream}} with |internalStream|, |transport|, and |sendOrder|. + {{WebTransportBidirectionalStream}} with |internalStream|, |transport|, |sender|, and |sendOrder|. 1. [=Resolve=] |p| with |stream|. 1. Return |p|. @@ -1030,6 +1033,8 @@ these steps. 1. Let |transport| be [=this=]. 1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, return a new [=rejected=] promise with an {{InvalidStateError}}. + 1. Let |sender| be {{WebTransport/createUnidirectionalStream(options)/options}}'s + {{WebTransportSendStreamOptions/sender}}. 1. Let |sendOrder| be {{WebTransport/createUnidirectionalStream(options)/options}}'s {{WebTransportSendStreamOptions/sendOrder}}. 1. Let |p| be a new promise. @@ -1044,10 +1049,21 @@ these steps. 1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, [=reject=] |p| with an {{InvalidStateError}} and abort these steps. 1. Let |stream| be the result of [=WebTransportSendStream/creating=] a {{WebTransportSendStream}} with - |internalStream|, |transport|, and |sendOrder|. + |internalStream|, |transport|, |sender|, and |sendOrder|. 1. [=Resolve=] |p| with |stream|. 1. return |p|. +: createSender() + +:: Creates a {{WebTransportSender}}. + + When `createSender()` method is called, the user agent MUST + run the following steps: + 1. Let |transport| be [=this=]. + 1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, + [=throw=] an {{InvalidStateError}}. + 1. Return the result of [=WebTransportSender/creating=] a {{WebTransportSender}} with |transport|. + ## Procedures ## {#webtransport-procedures}
dictionary WebTransportSendStreamOptions { - long long? sendOrder = null; + WebTransportSender? sender = null; + long long sendOrder = 0; };The dictionary SHALL have the following attributes: +: sender +:: An optional {{WebTransportSender}} to [=group=] this + {{WebTransportSendStream}} under, or null. + : sendOrder :: An send order number that, if provided, opts the created {{WebTransportSendStream}} in to participating in strict ordering. @@ -1420,7 +1441,8 @@ data to the server.
[Exposed=(Window,Worker), SecureContext, Transferable] interface WebTransportSendStream : WritableStream { - attribute long long? sendOrder; + attribute WebTransportSender? sender; + attribute long long sendOrder; Promise<WebTransportSendStreamStats> getStats(); };@@ -1434,6 +1456,16 @@ The {{WebTransportSendStream}}'s [=transfer steps=] and ## Attributes ## {#send-stream-attributes} +: sender +:: The getter steps are: + 1. Return [=this=]'s {{WebTransportSendStream/[[Sender]]}}. +:: The setter steps, given |value|, are: + 1. If |value| is non-null, and + |value|.{{WebTransportSender/[[Transport]]}} is not + [=this=].{{WebTransportSendStream/[[Transport]]}}, [=throw=] + an {{InvalidStateError}}. + 1. Set [=this=].{{WebTransportSendStream/[[Sender]]}} to |value|. + : sendOrder :: The getter steps are: 1. Return [=this=]'s {{WebTransportSendStream/[[SendOrder]]}}. @@ -1482,9 +1514,13 @@ A {{WebTransportSendStream}} has the following internal slots.
+[Exposed=(Window,Worker), SecureContext] +interface WebTransportSender { + Promise<WebTransportSendStreamStats> getStats(); +}; ++ +A {{WebTransportSender}} is always created by the +[=WebTransportSender/create=] procedure. + +## Methods ## {#sender-methods} + +: getStats() +:: Aggregates stats from all {{WebTransportSendStream}}s + [=associated=] with [=this=] sender, and reports the result + asynchronously. + + When getStats is called, the user agent MUST run the following steps: + 1. Let |p| be a new promise. + 1. Let |streams| be all {{WebTransportSendStream}}s whose + {{WebTransportSendStream/[[Sender]]}} is [=this=]. + 1. Run the following steps [=in parallel=]: + 1. Gather stats from all |streams|. + 1. Wait for the stats to be ready. + 1. [=Queue a network task=] with |transport| to run the following steps: + 1. Let |stats| be a [=new=] {{WebTransportSendStreamStats}} object + representing the aggregate numbers of the gathered stats. + 1. [=Resolve=] |p| with |stats|. + 1. Return |p|. + +## Internal Slots ## {#sender-internal-slots} + +A {{WebTransportSender}} has the following internal slots. + +
Internal Slot + | Description (non-normative) + |
---|---|
`[[Transport]]` + | The {{WebTransport}} object owning this {{WebTransportSender}}. + |