2 articles on Reverse Ajax

I came across a nice intro to Reverse Ajax with a whole set of simple graphics to explain the interaction.

The blog entry is on the curiously named gmapsdotnetcontrol blog, and we go through the classic and Ajax models (JJG style) with polling and comet before getting to the piggyback model:

And finally the Full Monty Reverse Ajax

For me Reverse Ajax is not so much about the technology on how we get the message to the browser, but more about the programmers interface.

DWR gives you a dead simple set of APIs that dynamically generate Javascript and send the Javascript to one or many browsers asynchronously.

The DWR Chat example has to be the simplest code to do chat anywhere. The full source can be seen through fisheye, but the core goes like this:

WebContext wctx = WebContextFactory.get();
String currentPage = wctx.getCurrentPage();

// Find all the browsers on the current page:
Collection sessions = wctx.getScriptSessionsByPage(currentPage);
DwrUtil utilAll = new DwrUtil(sessions);

// Manipulate all the browsers to repopulate the message list
utilAll.addOptions("chatlog", messages, "text");


The other article is based on this one at Wikipedia and they are both based on Jon's original article.


Comments have been turned off on old posts