node-https

Solutions for fixing node.js https library when huge amount of request need be sent concurrently

若如初见. 提交于 2020-01-07 07:49:09
问题 I am currently working with project that huge amount of https requests (~15K~20K per second) need be sent via node.js server (node v4.2.6). The general relevant code structure can be seen at final of this post. We have tried by sending approximately 10~20 https requests per second, and every thing runs successfully, meaning there should not have problems on requests header and body itself. However, issues occurs when we start scaling up Nodejs server for sending thousands and millions

Trello responds 'invalid key'

纵然是瞬间 提交于 2019-12-10 18:43:05
问题 I am trying to get JSON data for a Trello board using the following URL, using Node.js's https module: https://trello.com/b/nC8QJJoZ.json Here's my code: var https = require('https'); https.get('https://trello.com/b/nC8QJJoZ.json', function (res) { console.log('statusCode:', res.statusCode); console.log('headers:'); console.log(res.headers); res.setEncoding('utf8'); res.on('data', function (chunk) { console.log(chunk); }); }).on('error', function (e) { console.log('ERROR: ' + e); }); Although

Socket hang up when using axios.get, but not when using https.get

爱⌒轻易说出口 提交于 2019-12-08 02:47:55
问题 To the best of my knowledge, I am doing the same thing using 2 different approaches: const https = require("https"); const axios = require("axios"); let httpsAgent = new https.Agent({rejectUnauthorized: false}); axios.get(`https://${hostname}:${port}${path}`, {httpsAgent}) .then((data) => { console.log("axios success: " + data.substr(0, 100)); }) .catch((error) => { console.log("axios error: " + error); }); let data = ""; https.get({ hostname, path, port, agent: httpsAgent }, (response) => {