Question

I'm trying to implement HTTP Streaming by using IHttpAsyncHandler and flushing.

Basically I'm flushing to the response every once and a while - saving the connection opened untill some timeout - and then the client should initiate another connection.

The flush indeed works and the client receives the flushes as they occur, however the response is getting aggregated. For example, if I send the following flushes:

"TextOnFlush1"
"TextOnFlush2"
"TextOnFlush3"

The client will get the following flushes (in the XMLHttpRequest.responseText):

"TextOnFlush1"
"TextOnFlush1""TextOnFlush2"
"TextOnFlush1""TextOnFlush2""TextOnFlush3"

As you can see eventually the client will have to handle with a very large message (which will contain all the previously flushes). Is there a way to work with the flush, but to clean the respone on each flush?

Notice that the response header contains this header : "Transfer-Encoding:chunked", which means that I should indeed get the content in chunks but instead I get the aggregated messages.

Was it helpful?

Solution

So there is no way to get the browser to clean the response on each flush - so it is a good practice to limit this msg size and to refresh the streaming message on large data once in a while.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top