The most relavent post I saw was: Streaming Http responses with NodeJS
Just to verify with others here, there is no longer any way from a browser to access the xhr.responseText before it is completed, right?
If impossible, I will just have to make all clients poll like 20 times a second or something.
Node.js server part
app.get('/peek', function(request, response) {
console.log(' Client Connected');
response.write('o');
response.write('hai');
response.write('der');
response.end();
setTimeout(function() { // Delay a bit
response.writeContinue();
response.write(' bear');
response.end();
}, 250);
}
Client JavaScript part
oReq.onreadystatechange=function() {
switch(this.readyState) {
case 1:
ptr=this;
console.log('Opened: ');
break;
case 2:
console.log('Header Recieved: '+this.status);
break;
case 3:
console.log('Loading: '+this.status);
break;
case 4:
console.log('Recieved: '+this.status);
break;
}
if(2<this.readyState) console.log(this.responseText);
}