简体   繁体   English

并行 HTTP 请求 JavaScript 的库

[英]Parallel HTTP requests library for JavaScript

I'd like to make number of http requests in parallel;我想同时发出多个 http 请求; with either one error response or a number of them.带有一个或多个错误响应。 Having done that myself a few times (with just a loop & counter), I'd like to use one that is more robust, and will handle edge cases.我自己做了几次(只有一个循环和计数器),我想使用一个更健壮的,并且可以处理边缘情况。

Do you know if there's a library / micro-framework out there that will do this?你知道是否有一个图书馆/微框架可以做到这一点吗? One, to which I can provide a number of URLs, a success callback method (for each), a single error callback;一个,我可以提供多个 URL,一个成功回调方法(每个),一个错误回调; and possibly other options.以及可能的其他选择。 This library would follow 301s, call the err-cb if any or all requests time-out or fail.该库将遵循 301,如果任何或所有请求超时或失败,则调用 err-cb。

Use one of the flow-control libraries:使用流控制库之一:

Node.js does have maxSockets . Node.js 确实有maxSockets I think this library might come close to your requirements => https://github.com/SaltwaterC/http-get ?我认为这个库可能会接近您的要求 => https://github.com/SaltwaterC/http-get

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM