Saturday, March 24, 2012

Ajax and push mode?

Is it possible to realize "push mode" with AJAX and asynchronous callbacks?
It would be interesting to update a part of a web page triggerd by the web server
when something has changed by another user.
Rolf

First of all. Do youwant "Real Time" or "Near Real Time" data. Cause if you want "Real Time", you need some kind of ActiveX objectinstalled on the client listening for new messages or monitoring a queue on theserver. This requires a lot more code. But if you want "near Real Time" then trythis…

Put a Javascript timer() on the page to call the "GetDataOnServer"function every 'n' seconds or minutes. If new data is available on the server, then it appears on yourpage. If not, then no data is sent. Just an idea that works for me. And from a user standpoint, it looksgreat. Gmail is doing the same thing intheir INBOX, I think.


Not really. You could fake it however by polling the server once in awhile (Web.Timer may be useful to refresh data every n seconds). On theserver you could keep track of what data is dirty since the last time auser retrieved its data.

I have been actively surveying Ajax solutions, and the only one that Ihave found that seems to support true asynchronous data push isICEfaces by ICEsoft. See www.icesoft.com. Of course this isa JSF/J2EE approach and may not be of interest to you .net'ers, but itlooks like a very cool solution to the Ajax problem. They havesome very impressive demos including chat, auction, and emailapplications. I will let you know if I come across anything else.
Mary Stephens

No comments:

Post a Comment