WebSocketStream

The WebSocket API provides a JavaScript interface to the RFC6455 WebSocket protocol. While it has served well, it is awkward from an ergonomics perspective and is missing the important feature of backpressure. The intent of the WebSocketStream API is to resolve these deficiencies by integrating streams with the WebSocket API.

Currently applying backpressure to received messages is not possible with the WebSocket API. When messages arrive faster than the page can handle them, the render process will either fill up memory buffering those messages, become unresponsive due to 100% CPU usage, or both. Applying backpressure to sent messages is possible but involves polling the bufferedAmount property which is inefficient and unergonomic.

Demo

Documentation

Status in Chromium

Blink>Network>WebSockets


Origin trial (tracking bug) in:

  • Chrome for desktop release 78
  • Chrome for Android release 78

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

  • No public signals
  • No public signals
  • No public signals
  • No signals

Owners

Last updated on 2019-09-05