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

WebSocketStream: Stream-based backpressure-supporting API for the WebSocket protocol #315

Open
ricea opened this issue Feb 6, 2024 · 5 comments
Labels
topic: networking topic: web apis Spec relates to web APIs (entry points for script) venue: WHATWG HTML Workstream

Comments

@ricea
Copy link

ricea commented Feb 6, 2024

WebKittens

@annevk

Title of the spec

WebSocketStream

URL to the spec

https://whatpr.org/websockets/48.html#the-websocketstream-interface

URL to the spec's repository

https://github.com/whatwg/websockets

Issue Tracker URL

No response

Explainer URL

https://github.com/ricea/websocketstream-explainer/blob/master/README.md

TAG Design Review URL

w3ctag/design-reviews#394

Mozilla standards-positions issue URL

mozilla/standards-positions#970

WebKit Bugzilla URL

No response

Radar URL

No response

Description

WebSocketStream is a new API for the WebSocket protocol that enables backpressure by integrating with Streams. The benefits are better behaviour when one side cannot keep up with the data rate, and a more modern API.

@annevk annevk added topic: networking topic: web apis Spec relates to web APIs (entry points for script) venue: WHATWG HTML Workstream labels Feb 28, 2024
@annevk
Copy link
Contributor

annevk commented Feb 28, 2024

Overall this looks good. However, do you have some data that supports investing more in WebSocket? Now there's WebTransport and streaming in fetch it's becoming kind-of niche so it would be good to know this effort is worth the ongoing maintenance cost.

@ricea
Copy link
Author

ricea commented Mar 4, 2024

Chrome sees WebSockets used on 10% of page loads: https://chromestatus.com/metrics/feature/timeline/popularity/1149

For comparison WebTransport is still at 0.002% of page loads: https://chromestatus.com/metrics/feature/timeline/popularity/3472

I think that's an indication of the time it takes to ramp up support for a new protocol. WebTransport can do a lot more than WebSocket, but it will be years before it is as easy to deploy. WebTransport is a powerful investment for the future, whereas WebSocketStream is a practical investment for the present.

Most (all?) major server-side environments have mature, solid WebSocket support.

WebSockets are widely supported by CDNs: https://www.cdnplanet.com/guides/websockets/#:~:text=without%20an%20origin%3F-,CDN%20comparison,-Yes

Interest in WebSockets is growing for some reason: https://insights.stackoverflow.com/trends?tags=websocket

Page load percentages for some vaguely related technologies:

@annevk
Copy link
Contributor

annevk commented Mar 4, 2024

Thanks! I should have specifically asked for web developer interest as we're curious what adoption might look like. Per https://chromestatus.com/feature/5189728691290112 there's no indication this is desired?

And per https://issues.chromium.org/issues/41470216 the little feedback that was given seemed to desire a fix for backpressure on top of the existing API?

@tomayac
Copy link

tomayac commented Mar 4, 2024

For developer interest:

  • The Deno runtime has implemented the WebSocketStream interface.
  • A polyfill to use the API in current browsers exists.

@mkurz
Copy link

mkurz commented Oct 14, 2024

I am a developer and I am very interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: networking topic: web apis Spec relates to web APIs (entry points for script) venue: WHATWG HTML Workstream
Projects
None yet
Development

No branches or pull requests

4 participants