I recently ran across AjaxTerm. It's pretty neat. It got me rather excited as I think it would be a really cool part of a xen Web-based management console.
I was rather curious how it worked with respect to updates. Clearly, when you send console data it requires an HTTP request. That's unavoidable. However, how do you detect when it's time to receive console data? There's no such thing as a reverse HTTP connection so that's out of the question. A naive solution would be to poll the server. That seems rather wasteful though. More importantly, there is an inevitable lag depending on how tightly you loop.
That got me thinking about an alternative approach this evening. What if you started a request (asynchronous of course) and the server simply didn't respond right away. Even if the browser eventually times out the connection, as long as it lasts for a pretty good portion of time, you could use this as a way to wait (without polling) for new data to arrive. So far, some experiments have shown promise. We'll see whether this results in a noticeable effect on latency.