2006-04-17
Pushing events from the server to the browser
I've written in the past about the ways of pushing events from the server to the web browser. Recently a this model of usage has had a term defined for it called 'Comet'.
My plan was to have a library that modelled a web page as an asynchronous Erlang process. Other Erlang processes can send it messages using the standard Erlang constructs and the clients browser would process these messages. I put a proof of concept here.
This model of usage is becoming more and more popular evidenced by the number of Ajax based chat applications as well as the new 'Comet' term. The latest release of the Java based DWR library has added functoinality similar to the message passing example mentioned above.
DWR 2.0 allows what they are calling 'reverse ajax'. A simple to use API that enables the web server to call javascript functions on the browser.
The big new feature is Reverse Ajax: DWR 1.x allowed you to asynchronously call Java code from Javascript. DWR 2.0 builds on this to allow you to asynchronously call Javascript code from Java. Reverse Ajax makes writing interactive applications much easier. Reverse Ajax makes writing interactive applications much easier. It can use polling or Comet (long-lived HTTP) queries.