I am designing an ASP.NET web application (.NET 4.0) which basically has a page that should interact with the code behind every 1-2 seconds (Using Client callbacks or PageMethods via ScriptManager or jQuery.ajax) It'll be hosted on an intranet, so a 1-2 second refresh rate is kind of reasonable.
How can I make the page to access the web service/pagemthod in the code behind in a timeply manner (e.g. every 1 second). Should I use a javascript timer (I'm not familiar with javascrip very much)?
Although the site is hosted on an intranet, but I still need to implement a good approach to reach the desired refresh rate. the amount of data being transfered is about 1KB in each interaction. What are your recommendations on my design regarding this? (using callbacks or ScriptManager or jQuery.ajax,... any pitfalls I should avoid)
Thanks.
A 1kb request every 1-2 seconds is reasonable using either approach. A page method or web service (they're nearly identical under the hood) that does nothing will respond in just a few milliseconds if you're dealing with a fast network/server.
The limiting factor will be how long the meat of your server-side method takes to complete (i.e. if it's involves a database or external service, that's going to slow you down more than the overhead of the service).