GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — False successfully end of request · Issue #8102 · nodejs/node Closed Labels docIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.httpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.testIssues and PRs related to Node.js core tests and test infrastructure.Issues and PRs related to Node.js core tests and test infrastructure. Description
Long client requests ends successfully if data transfer closed for some reason, for example if server lost connectivity or suddenly fall. Example server send parts of JSON object for ~2 seconds. For test purpose I run following shell command: timeout 1s node server.js & node client.jsBecause data transfer lasts 2 seconds client app receive only part of data but ends with emit Example of client app: var http = require('http'); var makeRequest = function() { var req = http.request({ host: '127.0.0.1', port: 8080, method: 'POST', }, function(res) { var data = ''; res.on('data', function(chank) { data += chank; }); res.on('end', function() { console.log('data', data); console.log('succesfull end'); }); res.on('error', function(err) { console.error(err); }); }); req.on('error', function(err) { console.error(err); }); req.write(''); req.end(); }; setTimeout(makeRequest, 100); Example of server app var http = require('http'); var server = http.createServer(); server.on('request', function (req, res) { res.write('{"result":[{"some": "object"}'); // it must send data pieces for ~2 sec (20*100 ms = 2000 ms) var times = 20; var delay = 100; var counter = 0; var timerId = setInterval(function() { res.write(',{"some": "object"}'); counter++; if (counter >= times) { res.write(',{"some": "object"}'); res.write(']}'); res.end(); clearInterval(timerId); } }, delay); }); var port = 8080; server.listen(port, function() { console.log('listen on 127.0.0.1:' + port); }); Activity
MetadataMetadataAssigneesLabelsdocIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.httpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.testIssues and PRs related to Node.js core tests and test infrastructure.Issues and PRs related to Node.js core tests and test infrastructure. TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |