Reputation: 2189
I have a webpage where users submit a task that is picked up by a windows process (that checks a SQL table if any items have processed flag = false). Once processed, the flag is set to true. I need to update the processed status on the webpage. What's the most efficient way of doing this? (I understand that one way to do it is to fire off ajax requests every few seconds)
Upvotes: 1
Views: 361
Reputation: 33149
Comet, or pushing data from the webserver to the browser rather than polling from the browser to the server, can be what you are looking for.
Check out http://www.aaronlerch.com/blog/2007/07/08/creating-comet-applications-with-aspnet/
Upvotes: 0
Reputation: 8595
Comet is an interesting approach to updating the browser to show progress. The only other option at the moment (that I know of) is polling however as you suggested
To summarize comet: You keep a connection open from the webserver and periodically send script blocks with javascript in them. These run automatically when downloaded by the browser and can be used to update progress. You only need to send a script block when you have an update, the rest of the time the connection remains open but idle
Upvotes: 1
Reputation: 27441
Since web by design doesn't support push, but instead pulls for data, AJAX is the way that makes the most sense.
You can also partake in some hidden iframe with periodic refreshing hackery, but that's just ughh.
Upvotes: 0