Hacker News new | ask | show | jobs
by connordoner 1154 days ago
This is one of the oldest tricks in the book and was used heavily before WebSockets and similar became mainstream.
2 comments

Monit does to this produce a live feed. It’s kind of annoying sometimes, you lose highlighted text.
I fondly remember html-only iframe chats.
IIRC CGI:IRC had an even more clever version of this: still no JavaScript needed, but Also no refresh needed, as the chat frame response would simply be held open and stream new messages. I never dug too deep into it, but it seemed to work surprisingly well.
Ha remember that too! It’s basically just keeping the socket open and continuously streaming a response. As if it’s just a slow download. It’d also send heartbeat null values to keep the connection open. Of course in the CGI days that really didn’t scale well as it required a whole process to run for each user.
it scaled as well as you would expect coming from those days.

the alternative was a whole computer plus modem per user.

This is called Server Sent Events, SSE for short.

https://developer.mozilla.org/en-US/docs/Web/API/Server-sent...

SSE is cool, but as others have pointed out, this isn't that. I also wouldn't call this Comet: almost unilaterally, Comet referred to using it in concert with JS/Ajax and usually was just a fancy way of saying long-polling (though I admit it's a bit broader than that in truth). What CGI:IRC did was different: it streamed HTML directly. More to the point, it didn't use chunked encoding or any kind of framing in the body. It just kept the connection open and kept sending HTML in realtime. I don't think this ever had a term associated with it, or at least I was never aware of one.
Looks like 'Comet' got coined in 2006. The CGI:IRC approach.. I had a smile and an "aha" on seeing the term "forever frames" :-)

I think the wiki page is wrong that it involved chunked encoding

Woah! I completely and entirely forgot the term "forever frame" existed.

Another term you don't see too often these days is the "holy grail" layout. I definitely remember the days of messing with negative margins and clearfix to get my page layouts to look nice while still working in IE 6 :)

SSE came along much later. At the time it was common-ish to just slowly send HTML tags. I think at some point there was a gorgeous hack where they dynamically rendered and sent GIF frames with the messages of the chatroom.
The broader technique became known as Comet: https://en.wikipedia.org/wiki/Comet_(programming)

CGI:IRC used an early frame approach, no JS required.

At some point JSONP became popular, even for 3rd party APIs.

  <script src="http://dont-xss-me/please?format=jsonp&callback=lol">
Server writes:

  lol({ ... })

  lol({ ... })
That’s the modern variation. The original didn’t have any framing like they.
controversial opinion, frames were awesome...for some things
I got PTSD... then again, a lot of things were wrong about that system. GET requests casually loading up whole database in memory while calling stored procedures that inexplicably modify like half of persisted version of it. and that's just to render some stupid list o_0
agreed, I help make Chemistry World with a chemist that had a cool 3d .mol viewer with frames back in the day when 3d was pretty fancy :)
And webcams. I still see these occasionally and wonder if something is broken before realizing it's old-school.