by v3ss0n · 2y ago · 0 comments
The problem with not adopting is due to Websocket getting more popular and Devs stop caring about HTTP2 altogether. But there are many cases Websocket is overkill , even text chat application dosen't need websocket.
Similar functionality can already be achieved by using SSE/Eventsource although HTTP/2 Push was more powerful.
HTTP/2 Server Push is another thing. It allows server to send additional related resources to a client without the client explicitly requesting.
IETF RFC 8441 (https://www.rfc-editor.org/rfc/rfc8441.html) described a way to bootstrap WebSocket under HTTP/2.
That said, I don't know whether or not people are actually doing it in the wild.
On the client side, both Chrome (https://chromestatus.com/feature/6251293127475200) and Firefox will use it when available, but I have encountered some issues with cross-origin support (https://issues.chromium.org/issues/363015174)
I am also skeptical of the "doesn't need websocket" statement. It is technically true that you can use other technologies. But, WebSockets provide bidirectional communication, while Ajax Polling and Long Polling are used for periodic updates. HTTP/2 Push is more suited for pushing resources or data from the server to the client. As far as my understanding goes the use case there is specifically aimed at pushing resources the server "knows" the client will need as well without the client requesting them. I am sure that with some creative code you can also use this to implement a chat of sorts but that is a bit besides the point.
Even is if is a misunderstanding it would still be useful to consider.
The other things are for bidirectional communication with a server.
I would consider them very much apples and oranges. Its not just that they are designed for different purposes; i don't think it is possible to even use server push for the purpose websockets is used for in the browser.
Are you asking because you basically want to know more about the technologies? In that case why not frame it like that?