New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 840253 link

Starred by 5 users

Issue metadata

Status: Assigned
Owner:
Last visit > 30 days ago
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Feature



Sign in to add a comment

Backpressure for WebSockets

Project Member Reported by ricea@chromium.org, May 7 2018

Issue description

Chromium's WebSocket implementation supports backpressure, but this is not exposed to the Javascript API. What this means in practice is that backpressure will only be applied at or close to 100% utilisation, which is too late to ensure a smooth user experience.

This is a placeholder for the issue.
 

Comment 1 by ricea@chromium.org, May 7 2018

Cc: domenic@chromium.org yhirano@chromium.org
Components: Blink>Network>WebSockets
Some ideas that have been discussed for incoming messages:

* A single readable stream per WebSocket. Similar to https://streams.spec.whatwg.org/#example-rs-push-no-backpressure, but with streams.
* A WebSocket is represented as a stream of streams. Backpressure is applied by preventing reading a message until the previous one has been completely read or cancelled.
* Hybrid streams / events: each MessageEvent provides a stream in e.data. A new event won't be fired until the previous stream is closed.
* The onmessage handler can return a promise to indicate when it is not ready for a new message. yhirano@ says this won't work because onmessage is used in other places in the platform.
* Explicit suspend() and resume() methods.

All of these imply changes to the HTML standard.

Comment 2 by ricea@chromium.org, May 7 2018

Some ideas that have been discussed for outgoing messages:

* An onbufferempty event which fires when bufferedAmount transitions from non-zero to zero.
* send(ReadableStream)
* WebSocket exposes a writable stream. write() on the stream is equivalent to calling send(), except backpressure signals are available.
* As above, plus write(ReadableStream) permits arbitrarily large messages to be sent.
Labels: Proj-Fugu
Cc: reillyg@chromium.org
Labels: -Pri-3 Pri-1
Can you tell me the reason of the priority change?
Owner: kenjibaheux@chromium.org
Status: Assigned (was: Available)
hey kenji, can you help triage and assign an estimated milestone?
Labels: Needs-Investigation
Plan for now to Q1: exploration.
We'll assign Milestone and Priority based on what we learn.
Cc: goto@chromium.org
sam for investigation. 

Sign in to add a comment