0

Is it possible to send update (or automatic response) from a SERVER to a WEB APPLICATION?

I have a SERVER that updates data every 5 min (sometimes random). I want to update the new data on a running WEB APPLICATION without making a request from brower to server.

Right now I execute an ajax request every 5min so that I can update the latest data. But sometimes no data is updated. Also, sometimes the data gets updated at eg. 9:01 am and the update executes at eg. 9:05am. What i would like to do is: immediately update web application when the data gets updated on the server.

Any ideas on how this could be implemented? I can use any technology/language or anything that is required to do this.

Regards

user427969
  • 3,782
  • 4
  • 44
  • 72

4 Answers4

4

You’re describing HTTP server push technology. There are many ways to implement it, but knowing what it’s called should help you get started.

Herbert
  • 5,302
  • 2
  • 20
  • 34
3

I believe you want to use this model: http://en.wikipedia.org/wiki/Comet_(programming)

Pat
  • 23,890
  • 6
  • 66
  • 67
John Cornell
  • 1,087
  • 8
  • 21
0

You can try SQL server notification, but you have to do a lot of business logic around it.

Luke
  • 11,310
  • 43
  • 59
  • 67
Raghav
  • 2,402
  • 4
  • 27
  • 49
  • Thanks Kevin, I want to send data update (new data) to the web application. Regards – user427969 Sep 29 '11 at 01:13
  • ok.. u sql notification is like, u subsribe for a query in sql server. when the result of the data is changed,(like the data is inserted/updated in the seleted table) then u get a notification in web application – Raghav Sep 29 '11 at 01:16
  • Thanks Raghav, sounds interesting. I'll look into it in detail – user427969 Sep 29 '11 at 01:26
0

The client-server relationship cannot be reversed. The browser has to be the one to initiate any communication.

However, you can quite easily poll the server at short interval to ask "has anything changed?". Then, according to the result, you could refresh all or part of the data with a second AJAX call.

Kevin Coulombe
  • 1,453
  • 1
  • 15
  • 35
  • There is a specific way to do this, called "long polling" and is generally referred to as "Comet". Hammering a webserver (your suggestion) doesn't scale well. – Brian Roach Sep 29 '11 at 01:20