tjanczuk / iisnode

Hosting node.js applications in IIS on Windows
Other
1.86k stars 586 forks source link

Streaming data never reaches client #504

Open watt opened 8 years ago

watt commented 8 years ago

I am running into a problem similar to the one in #386, running a very simple app that streams data continuously until the client disconnects:

var server = http.createServer();
server.on('request', function(request, response) {
    var interval = setInterval(function() {
        response.write("some data\r\n");
    }, 1000);
    request.on('close', function() {
        clearInterval(interval);
    });
});
server.listen(config.port);

I have set flushResponse to true in both the iisnode.yml file and in web.config.

Logging on the server indicates that node is writing chunks and they are being flushed. But client connections never receive any data. Even the headers do not come through.

I'm running on an Azure App Service.

I've also posted this question on Server Fault and the MSDN forums but have yet to find a fix.

markusahlstrand commented 8 years ago

I posted in the issue you references but might as well write here as well. We had a simliar issue and had to set the responseBufferLimit to 0 to make it work:

 <handlers>
    <add name="iisnode" path="app.js" verb="*" modules="iisnode" responseBufferLimit="0"/>
 </handlers>
watt commented 8 years ago

Yeah, I tried setting responseBufferLimit as well, but it didn't make a difference.

sahilNaran commented 8 years ago

What's the difference between flushResponse="true" and responseBufferLimit="0", both seems to work fine?

markusahlstrand commented 8 years ago

I think that the flushResponse only affects the node process whereas the responseBufferLimit sets the outbound buffer to 0 in IIS