Hacker News new | ask | show | jobs
by apitman 815 days ago
WebSockets is an interesting case where the underlying transport (TCP) provides backpressure for free, but the way the API was designed in browsers throws it away. For example, it's trivial to fill your device's memory by opening a large local file in your browser and attempting to stream it to a server in a tight WebSocket send loop.

I'm not sure if there was an alternative when WebSockets was designed. Did we even have promises yet?

This sort of thing is solved nowadays with WhatWG streams. They're a bit verbose to work with but I've been impressed with the design.