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 rate control event #421

Merged
merged 42 commits into from Feb 14, 2023
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
ebb8988
Add congestion control event
Sep 27, 2022
7251fb8
Add congestion control event
pthatcher Sep 27, 2022
4cf1042
Add interval control and some other changes based on feedback
pthatcher Sep 27, 2022
dab1f13
Tweak when the event fires
pthatcher Nov 21, 2022
6bfef66
Update index.bs
pthatcher Dec 7, 2022
6221f72
Update index.bs
pthatcher Dec 7, 2022
6a3700c
Update index.bs
pthatcher Dec 7, 2022
299e395
Add Exposed attribute
pthatcher Dec 7, 2022
4121eeb
Remove Ms suffix and add congestionControl property
pthatcher Dec 20, 2022
7bbf7fc
Change to a dictionary and define more clearly.
pthatcher Dec 20, 2022
f939533
Add more info about congestionControl.
pthatcher Dec 20, 2022
cf97c25
Specify pooling
pthatcher Dec 20, 2022
ace7746
Fix name
pthatcher Dec 20, 2022
28330ff
Remove broken IDL refernce
pthatcher Dec 20, 2022
4a43e7c
Remove more broken IDL refernces
pthatcher Dec 20, 2022
4394148
Rename dequeueRate to sendRate
pthatcher Dec 20, 2022
2f279ca
Add privacy and security section
pthatcher Dec 20, 2022
c251da7
Change back to an interface
pthatcher Dec 20, 2022
24af5a9
Update index.bs
pthatcher Jan 17, 2023
9f8e7e2
Update index.bs
pthatcher Jan 17, 2023
833a26f
Update index.bs
pthatcher Jan 17, 2023
0bed778
try to fix bikeshed errors
pthatcher Jan 17, 2023
dc9acae
Add link defaults to make bikeshed happy
pthatcher Jan 17, 2023
932e7ac
Add Exposed
pthatcher Jan 17, 2023
791c607
Merge with main
pthatcher Jan 17, 2023
93de83d
Make WebTransport an EventTarget and define the WebTransport/ratecont…
pthatcher Jan 17, 2023
3b45c56
Update index.bs
pthatcher Feb 14, 2023
91288e2
Update index.bs
pthatcher Feb 14, 2023
e3e7a11
Update index.bs
pthatcher Feb 14, 2023
b3728d9
Update index.bs
pthatcher Feb 14, 2023
d93882d
Update index.bs
pthatcher Feb 14, 2023
ec25dd4
Update index.bs
pthatcher Feb 14, 2023
13586bf
Update index.bs
pthatcher Feb 14, 2023
fbd45ad
Update index.bs
pthatcher Feb 14, 2023
d606678
Update index.bs
pthatcher Feb 14, 2023
9c50c6b
Update index.bs
pthatcher Feb 14, 2023
a5b0c8f
Remove need for bidi include
pthatcher Feb 14, 2023
c17693b
Update index.bs
pthatcher Feb 14, 2023
3239355
Remove spec:infra
pthatcher Feb 14, 2023
c7ef1f7
Make default min interval readable
pthatcher Feb 14, 2023
2fbd1be
Add some internal slots
pthatcher Feb 14, 2023
adacfb9
Fix bikeshed
pthatcher Feb 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
123 changes: 122 additions & 1 deletion index.bs
Expand Up @@ -539,7 +539,7 @@ defined in [[!WEB-TRANSPORT-HTTP3]].

<pre class="idl">
[Exposed=(Window,Worker), SecureContext]
interface WebTransport {
interface WebTransport : EventTarget {
constructor(USVString url, optional WebTransportOptions options = {});

Promise&lt;WebTransportStats&gt; getStats();
Expand All @@ -560,6 +560,10 @@ interface WebTransport {
optional WebTransportSendStreamOptions options = {});
/* a ReadableStream of WebTransportReceiveStream objects */
readonly attribute ReadableStream incomingUnidirectionalStreams;

attribute unsigned long rateControlFeedbackMinInterval;
attribute EventHandler onratecontrolfeedback;
[SameObject] readonly attribute WebTransportRateControlFeedback rateControlFeedback;
};

enum WebTransportReliabilityMode {
Expand Down Expand Up @@ -623,6 +627,16 @@ A {{WebTransport}} object has the following internal slots.
throughput or low latency was requested by the application and satisfied
by the user agent, or `"default"`.
</tr>
<tr>
<td><dfn>`[[RateControlFeedbackMinInterval]]`</dfn>
<td class="non-normative">A {{long}} indicating the maximum frequency
that the {{WebTransport/ratecontrolfeedback}} will be fired.
Comment on lines +632 to +633
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the minimum time between events? Or even the duration over which the event is suppressed after receiving another.

Sure interval is inversely proportional to rate, but only loosely.

</tr>
<tr>
<td><dfn>`[[RateControlFeedback]]`</dfn>
<td class="non-normative">A {{WebTransportRateControlFeedback}} providing
information about rate control.
</tr>
<tr>
<td><dfn>`[[Closed]]`</dfn>
<td class="non-normative">A promise fulfilled when the associated {{WebTransport}} object is
Expand Down Expand Up @@ -663,6 +677,8 @@ agent MUST run the following steps:
congestion control algorithms that optimize for |congestionControl|, as allowed by
[[!RFC9002]] [section 7](https://datatracker.ietf.org/doc/html/rfc9002#section-7),
then set |congestionControl| to `"default"`.
1. Let |rateControlFeedbackMinInterval| be 1000 milliseconds.
1. Let |rateControlFeedback| be a [=new=] {{WebTransportRateControlFeedback}}.
pthatcher marked this conversation as resolved.
Show resolved Hide resolved
1. Let |incomingDatagrams| be a [=new=] {{ReadableStream}}.
1. Let |outgoingDatagrams| be a [=new=] {{WritableStream}}.
1. Let |datagrams| be the result of [=WebTransportDatagramDuplexStream/creating=] a
Expand All @@ -685,6 +701,10 @@ agent MUST run the following steps:
:: "pending"
: {{[[CongestionControl]]}}
:: |congestionControl|
: {{[[RateControlFeedbackMinInterval]]}}
:: |rateControlFeedbackMinInterval|
: {{[[RateControlFeedback]]}}
:: |rateControlFeedback|
: {{[[Closed]]}}
:: a new promise
: {{[[Datagrams]]}}
Expand Down Expand Up @@ -855,6 +875,25 @@ these steps.
requested but not satisfied, then the value is `"default"`
The getter steps are to return [=this=]'s {{[[CongestionControl]]}}.

: <dfn for="WebTransport" attribute>rateControlFeedbackMinInterval</dfn>
:: The minimum interval between any two times when
the {{WebTransport/ratecontrolfeedback}} event is fired.
This effectively allows the application
to control the maximum frequency of this event.

: <dfn for="WebTransport" attribute>onratecontrolfeedback</dfn>
:: An [=event handler IDL attribute=] whose [=event handler event type=] is
{{WebTransport/ratecontrolfeedback}}.

: <dfn for="WebTransport" attribute>rateControlFeedback</dfn>
:: Information useful for the application to control the rate at which it sends data.

## Events ## {#webtransport-events}

: <dfn event for=WebTransport>ratecontrolfeedback</dfn>
:: Fired at the {{WebTransport}} when the {{WebTransport/rateControlFeedback}} has
changed.

## Methods ## {#webtransport-methods}

<div algorithm>
Expand Down Expand Up @@ -1289,6 +1328,7 @@ The dictionary SHALL have the following attributes:
:: The number of sent datagrams that were declared lost, as defined in
[[!RFC9002]] [Section 6.1](https://www.rfc-editor.org/rfc/rfc9002#section-6.1).


# Interface `WebTransportSendStream` # {#send-stream}

A {{WebTransportSendStream}} is a {{WritableStream}} providing outgoing streaming
Expand Down Expand Up @@ -1824,6 +1864,77 @@ object |transport|, and a |sendOrder|, run these steps.

</div>

# Interface `WebTransportRateControlFeedback` # {#rate-control-feedback}

A {{WebTransportRateControlFeedback}} contains information
useful for the application to adapt the rate at which it sends data.

<pre class="idl">
[Exposed=(Window,Worker), SecureContext]
interface WebTransportRateControlFeedback {
readonly attribute unsigned long long? sendRate;
};
</pre>

## Internal slots ## {#rate-control-feedback-internal-slots}

A {{WebTransportRateControlFeedback}} has the following internal slots.

<table class="data" dfn-for="WebTransportRateControlFeedback" dfn-type="attribute">
<thead>
<tr>
<th>Internal Slot
<th>Description (<em>non-normative</em>)
</tr>
</thead>
<tbody>
<tr>
<td><dfn>`[[SendRate]]`</dfn>
<td class="non-normative">The rate at which the {{WebTransport}} dequeues and sends data,
which is the maximum rate the application can send at without inducing queue buildup.
</tr>
</tbody>
</table>

## Attributes ## {#rate-control-feedback-attributes}

: <dfn for="WebTransportRateControlFeedback" attribute>sendRate</dfn>
:: The getter steps are to return [=this=]'s {{WebTransportRateControlFeedback/[[SendRate]]}}.
This is the rate at which queued data will be dequeued and sent by the user agent, in bits per second.
If the application wishes to avoid queuing, it can send at a rate less than this value.
This rate applies to all streams and datagrams that share a [=WebTransport session=]
and is calculated by the congestion control algorithm (potentially chosen by
{{WebTransport/congestionControl}}). If this [=WebTransport session=] is
pooled with others in a shared [=connection=], it is the rate at which the user
agent will drain the queues for this [=WebTransport session=]. If the user agent cannot
determine a value (perhaps because of pooling), it may leave the value unset.

## Procedures ## {#rate-control-feedback-procedures}

<div algorithm="create a WebTransportRateControlFeedback">

To <dfn for=WebTransportRateControlFeedback>create</dfn> a {{WebTransportRateControlFeedback}}, given a |sendRate|, run these steps:

1. Let |feedback| be a [=new=] {{WebTransportRateControlFeedback}}, with:
: {{WebTransportRateControlFeedback/[[SendRate]]}}
:: |sendRate|
1. Return |feedback|.

</div>

<div algorithm="updating a WebTransportRateControlFeedback">

When the user agent changes the rate at which it dequeues bytes for sending on a
{{WebTransport}} |transport|'s [=WebTransport session=],
it MUST [=queue a network task=] with |transport| to run these steps:
Comment on lines +1927 to +1929
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requirement is impossible, or nearly so. How does the UA monitor the rate?


1. Set |transport|.{{WebTransport/rateControlFeedback}}.{{WebTransportRateControlFeedback/[[SendRate]]}}
to the new rate for [=WebTransport session=].
1. Fire an event named {{WebTransport/ratecontrolfeedback}} at |transport|.
Comment on lines +1931 to +1933
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the event limiting feature here?


</div>


# `WebTransportError` Interface # {#web-transport-error-interface}

<dfn interface>WebTransportError</dfn> is a subclass of {{DOMException}} that represents
Expand Down Expand Up @@ -2140,6 +2251,16 @@ that the client knows what the server certificate is or how to contact it is
not sufficient. The application has to establish the identity of the client
in-band if necessary.

## Pooled Sessions

When pooling, if information from one session is affected by the activity of another
session, one session could infer information about the activity of another session.
For example, if the rate control feedback of one session is affected by the rate at
which an application is sending data on another session, one session could learn about the
the rate at which another application is sending data. To avoid this, a user agent
can restrict access to information or modify information provided. For example, it could leave
the send rate at an artifical value to make it more difficult to infer anything from it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty loose. This boils down to "maybe the browser could work something out", which is pretty unsatisfying. We should be more concrete, either block access to the attribute (which reveals the presence of another entity, so that needs thought) or define an exemplar strategy for making it available.


# Examples # {#examples}

## Sending a buffer of datagrams ## {#example-datagrams}
Expand Down