I am using IHttpAsyncHandler and XMLHTTPRequest to push messages to client with the help of following URL: http://www.codeproject.com/Articles/42734/Using-IHttpAsyncHandler-and-XMLHttpRequest-to-push but I make some changes, actually this example based to one client only and I have to send messages to multiple clients so I make these changes
public void ProcessRequest(HttpContext context)
{
var recipient = context.Request["recipient"];
lock (_obj)
{
string[] totalfrnds = ("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").Split(',');//<- This is just an example for many clients
foreach (var a in totalfrnds)
{
var handle = MyAsyncHandler.Queue.Find(q => q.SessionId == a);//<- check who's client is online or not
if (handle != null)
{
handle.Message = context.Request["message"];
handle.SetCompleted(true);
}
}
}
}
Now I have two problems
How to resolve this type of error? This is not a permanent error, it occurs randomly.
What is the limit of asynchronous thread in W3wp.exe, as when it exceeds 25 request it can't open next request and I have to reset the IIS to start again the application.