Skip to content

Instantly share code, notes, and snippets.

@RubenVerborgh
Created April 1, 2016 16:24
Show Gist options
  • Save RubenVerborgh/a27669b33602c7d1f7634102032ba154 to your computer and use it in GitHub Desktop.
Save RubenVerborgh/a27669b33602c7d1f7634102032ba154 to your computer and use it in GitHub Desktop.
Connection rate test
const http = require('http');
const baseUrl = 'http://en.wikipedia.org/wiki/', max = 100;
var index = 1;
(function fetchNext() {
if (index < max) {
var url = baseUrl + index++;
console.log(`fetching ${url}`);
request = http.request(url);
request.on('response', (response) => {
response.on('data', () => {});
});
request.end();
fetchNext();
}
})();
const http = require('http');
const baseUrl = 'http://en.wikipedia.org/wiki/', max = 100;
var index = 1;
(function fetchNext() {
if (index < max) {
var url = baseUrl + index++;
console.log(`fetching ${url}`);
request = http.request(url);
request.on('response', (response) => {
response.on('data', () => {});
response.on('end', fetchNext);
});
request.end();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment