Html: WebSocket - enable backpressure support by supporting Streams integration

Created on 8 Jan 2019  路  4Comments  路  Source: whatwg/html

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.

additioproposal needs implementer interest websocket

Most helpful comment

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.

All 4 comments

@ricea

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.

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.

Was this page helpful?
0 / 5 - 0 ratings