I have a webpage what asks through jQuery json data from webservice after every 1 second. If there is no data then webservice returns null.
The problem is that if client is on site over 24 hours then the browser will collect too much data and will crash. So I decided to set timeout to 60000 in jQuery ajax so it will wait for data and on server side I am trying to to somthing like this:
while(true)
{
if(thereIsData){
System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
new System.Web.Script.Serialization.JavaScriptSerializer();
string sJSON = oSerializer.Serialize(ActionList);
Context.Response.Output.Write(sJSON);
return;
}
Thread.Sleep(1000);
}
But if I use Thread.Sleep then it will lock entire page. I have tried threading EventWaitHandle and same result entire page is locked until there is data. I also tried creating other webservice but same results. Is there any way that I can do this?