Is there some way to PUSH data from web server to browser? Is there some way to PUSH data from web server to browser? ajax ajax

Is there some way to PUSH data from web server to browser?


Yes, what you're looking for is COMET http://en.wikipedia.org/wiki/Comet_(programming). Other good Google terms to search for are AJAX-push and reverse-ajax.


Yes, it's called Reverse Ajax or Comet. Comet is basically an umbrella term for different ways of opening long-lived HTTP requests in order to push data in real-time to a web browser. I'd recommend StreamHub Push Server, they have some cool demos and it's much easier to get started with than any of the other servers. Check out the Getting Started with Comet and StreamHub Tutorial for a quick intro. You can use the Community Edition which is available to download for free but is limited to 20 concurrent users. The commercial version is well worth it for the support alone plus you get SSL and Desktop .NET & Java client adapters. Help is available via the Google Group, there's a good bunch of tutorials on the net and there's a GWT Comet adapter too.


Nowadays you should use WebSockets.This is 2011 standard that allows to initiate connections with HTTP and then upgrade them to two-directional client-server message-based communication.

You can easily initiate the connection from javascript:

var ws = new WebSocket("ws://your.domain.com/somePathIfYouNeed?args=any");ws.onmessage = function (evt) {  var message = evt.data;  //decode message (with JSON or something) and do the needed};

The sever-side handling depend on your tenchnology stack.