In a general chat application, the client browser always polls the 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 on Link Support in IIS .
This makes me think whether it is possible to transfer data from my server to the client browser by transmitting chunked HTTP (does that mean streaming, right?) And keep the connection open .
keeping the connection open, on the server I have an idea for something to start to check for 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); } }
what is the original idea.
Chat application created in ASP.net. With my less understanding of WCF and the advanced IIS streaming module, I need your advice on implementing this idea.
yea, Impossible is probably the answer. But I need to know why, if it's still not possible.
UPDATE (3 years later):
This is exactly what I was looking for: Microsoft ASP.NET SignalR
source share