In general chat application, client's browser always poll to server to check for new messages.
// the function to check new messages in server
function check(){
// but this question is less about jQuery.
$.ajax({
type: "POST",
url: "check.aspx",
data: "someparam=123",
success: function(msg){
// process msg here
// CHECK IT AGAIN, but sometimes we need to make delay here
check();
}
});
}
Then I read Nicholas Allen's blog about Keeping Connections Open in IIS.
It makes me think if it is possible to push data from my server to client's browser by transfer chunked HTTP (it means like streaming, right?) and keep the connection open.
while keeping the connection open, in server, I have idea to keep something run to check new messages. something like this, maybe
while(connectionStillOpen) {
// any new message?
if( AnyMessage() )
{
// send chunked data, can I?
SendMessageToBrowser();
// may be we need to make delay here
Sleep(forSomeTime);
}
}
that's a raw idea.
My Chat App created in ASP.net. With my less understanding of WCF and advanced IIS streaming module, I need your advice about to implement this idea.
yea, Impossible is probably the answer. But I need to know why if its still impossible.