I agree with SLaks - i.e. I use SignalR if you need a real-time web application with the website http://www.asp.net/signalr . It is difficult to implement a long survey well, let someone else handle this complexity, that is, use SignalR (a natural choice for WebApi) or Comet.
SignalR tries to use 3 other communication methods before resorting to long polling, web sockets, events sent by the server, and forever ( here ).
In some cases, you may be better off with a simple survey, i.e. punch every second or so to update ... take a look at this article. But here is a quote:
when you have a high volume of messages, a lengthy survey does not give any significant performance improvement over traditional polls. In fact, this could be worse because long-term polls can get out of hand in an unregulated, continuous cycle of immediate polls.
The fear is that with any significant load on your web page, your 30 second ajax request may be your own denial of service attack.
Even Bayeux ( CometD ) resorts to a simple poll if the load is too much:
Increased server load and resource hunger are eliminated by using the reconnect field and intervals for throttling clients, which in the worst case degrade traditional polling behavior.
Regarding the second part of your question.
If you use a lengthy survey, then your server should ideally only return an update if something really changed, so your user interface should probably βtrustβ the answer and assume that the answer means new data. The same applies to any approach like Server Push.
If you reverted to a simple polling method, you can use the built-in http methods to detect updates using the If-Modified-Since header, which will allow you to return 304 Not Modified, so the server will check the timestamp of the object and return 200 only with the object if it has been modified since the last request.