Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well, IMO h2 streams are more flushed out and offer better control than websockets, but that's just my opinion. In fact, websockets are your only "proper" option if you want hat bidirectional stream be binary - browsers don't expose that portion of h2 to JS.

Here is a silly thing that is possible with h2 over a single connection, but not with websockets:

Multiple page components (Islands) each have their own stream of events over a single h2 connection. With websockets, you will need to roll your own multiplexing[1].

[1]: I think you can multiplex multiple websockets over a single h2 connection tho, but don't quote me on this.



Multiplexing websockets has always seemed trivial to me. Curious to learn more about h2 streams though! Support is coming to JS and has already landed on Firefox and Chrome: https://developer.mozilla.org/en-US/docs/Web/API/WebTranspor...




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: