News for hackers. Stuff that matters.
Re:The future of web software is HTML over WebSockets by Asmod4n on Thursday February 25, 2021 @02:23PM (#26267009)
With this approach you can keep all of the traffic inside a WebWorker, so nothing blocks. You also get the benefit of not having to open a new connection for every request and automatic reconnects when someting goes wrong. The connection is most likely already established before you even need it.
Re:The future of web software is HTML over WebSockets by water8 on Thursday February 25, 2021 @02:25PM (#26267032)
You just described http2
Re:The future of web software is HTML over WebSockets by Asmod4n on Thursday February 25, 2021 @02:27PM (#26267065)
Wait, with http2 a webbrowser never closes the connection it has to a webserver?
Re:The future of web software is HTML over WebSockets by jlokier on Thursday February 25, 2021 @05:20PM (#26269067)
Even HTTP/1.1 from 1999 keeps a persistent connection open, if the client and server agree.

What it doesn't do so well is lots of parallel requests and responses out of order. HTTP/2 is better for that.

Both versions will close the connection if it's been idle for a while, and automatically reconnect as needed.

Re:The future of web software is HTML over WebSockets by qbasic_forever on Thursday February 25, 2021 @02:40PM (#26267235)
Yes, it's a long-lived TCP connection. It's not mandatory but the whole point of the protocol is to make one connection and send/receive all your assets over it instead of making more connections (which take time to setup and slow down page rendering).
Re:The future of web software is HTML over WebSockets by SahAssar on Thursday February 25, 2021 @03:00PM (#26267492)
It keeps it open as long as it is used and usually a bit past that. So if you have any traffic or are making periodic requests then it won't close the connection. If you are using SSE that can also use the same shared connection for streaming realtime updates to the client.