websockets icon indicating copy to clipboard operation
websockets copied to clipboard

WebSocket - enable backpressure support by supporting Streams integration

Open travisleithead opened this issue 6 years ago • 4 comments
trafficstars

Filed from TAG review of WebSocket in HTML spec: w3ctag/design-reviews#268

WebSockets predate Streams in the platform, but there's no reason why support for Streams can't be grafted into WebSockets! The primary motivations to add Stream support is to enable convenient backpressure management for applications.

Lack of backpressure is unfortunate. If you can't keep up with the network you run out of CPU or RAM.

Such integration would need to rationalize how the onmessage event would be impacted.

travisleithead avatar Jan 08 '19 21:01 travisleithead

@ricea

travisleithead avatar Jan 08 '19 22:01 travisleithead

We've been looking at this for Chrome. Our tentative plan is to create a new API called WebSocketStream. This avoids confusion over what should happen if you use the new streaming API and the old event-based API at the same time. It also lets us fix the "default binaryType is blob" issue.

ricea avatar Jan 09 '19 02:01 ricea

If that ends up being a thing, perhaps we should take that as an opportunity to create websocket.spec.whatwg.org and move the current API and https://fetch.spec.whatwg.org/#websocket-protocol there, as well as this new API.

annevk avatar Jan 09 '19 09:01 annevk

See https://github.com/w3ctag/design-reviews/issues/394.

ricea avatar Jul 12 '19 02:07 ricea