Re:Hotwire: HTML over the Wire
by jshen on Tuesday December 22, 2020 @01:20PM
(#25509363)
cgi-bin didn’t give you the ability to update a chat page across several different windows in near real-time.
[ Parent
| on HN ]
It did if you used XMLHttpRequest.
If you type a chat message in your browser, how does it automatically show up in my browser with XMLHttpRequest?
I think in Netscape 4 you could also make a request in an iframe which the server responded to with Content-Type: application/javascript and Transfer-Encoding: chunked. Then every time the server got an event it would write one chunk of javascript, which the client would execute immediately. This script could then call a callback in the parent frame.
In old school chat rooms, this was usually done by polling for new messages every X seconds, or doing a refresh / reload of an IFrame containing the chat.
I know, I wrote many of those, it’s a much worse solution than this.
Long Polling is how we used to do it. The web page opens a request to the server but the server does not reply. Once the event happens on the server, the server replies to the old request and the client opens a new request.
Yup, this is much better than that, and nicely integrated for you.
> cgi-bin didn’t give you the ability to update a chat page across several different windows in near real-time.
Servers could maintain an open connection and stream new data to the browser.
That was a much worse solution, and even worse with cgi-bin.
Sometimes worse is better.
Re:Hotwire: HTML over the Wire
by forgotmypw5 on Tuesday December 22, 2020 @08:17PM
(#25513383)
in no way elegant, but yes, with js, it's possible with netscape 3 and up, possibly with 2.
html, http, js, css are pretty thorough in their design, and it shows.
all the features described here are possible without any frameworks, this is merely a much easier way to build it than from scratch.