pwnall / node-xhr2

XMLHttpRequest emulator for node.js
MIT License
104 stars 41 forks source link

Turn off keepalive or re-use existing connections. #32

Closed ARitz-Cracker closed 6 years ago

ARitz-Cracker commented 6 years ago

Hey, something I use depends on this and I'm making, like, tens of thousands of http calls. Mind turning off keepalive so the OS doesn't freak out and run out of outgoing ports? Or if you want to put more effort, re-use existing connections?

pwnall commented 6 years ago

Can you set your own HTTP agent via XMLHttpRequest.nodejsSet?

API description: https://github.com/pwnall/node-xhr2/blob/c22c61dadf754c805bcf37af08e8f908b8ce730a/src/001-xml_http_request.coffee#L244

node.js Agents: https://nodejs.org/api/http.html#http_class_http_agent

ARitz-Cracker commented 6 years ago

Fair enough. Apologies for being harsh. I'll submit a PR to the repo I depend on so that things can be done properly.