WebSocketStream API came into play to make things easier with WebScoket API, which has the below limitations:
- Ergonomics isn't great.
- The important feature of
onmessageevent will keep firing until the page becomes completely unresponsive.
- To find out when it is safe to start sending messages again, it is necessary to poll bufferedAmount.
Goals of WebSocketStream API:
- Provide a WebSocket API that supports backpressure
- Provide a modern, ergonomic, easy-to-use WebSocket API
- Allow for future extension
^ From the explainer.
1 2 3 4 5 6 7 8
Thanks for authoring the spec and confirming this! 🤟 https://t.co/7bFMIzWPoL— Hemanth.HM (@GNUmanth) March 6, 2020