News for hackers. Stuff that matters.
Re:Hotwire: HTML over the Wire by jshen on Tuesday December 22, 2020 @03:36PM (#25510922)
If you type a chat message in your browser, how does it automatically show up in my browser with XMLHttpRequest?
Re:Hotwire: HTML over the Wire by fzzzy on Tuesday December 22, 2020 @06:20PM (#25512623)
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.
Re:Hotwire: HTML over the Wire by icedchai on Tuesday December 22, 2020 @03:44PM (#25511005)
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.
Re:Hotwire: HTML over the Wire by jshen on Tuesday December 22, 2020 @08:00PM (#25513285)
I know, I wrote many of those, it’s a much worse solution than this.
Re:Hotwire: HTML over the Wire by fzzzy on Tuesday December 22, 2020 @06:16PM (#25512596)
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.
Re:Hotwire: HTML over the Wire by jshen on Tuesday December 22, 2020 @08:01PM (#25513289)
Yup, this is much better than that, and nicely integrated for you.