3

I'd like to make number of http requests in parallel; 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; and possibly other options. This library would follow 301s, call the err-cb if any or all requests time-out or fail.

2
  • Isn't asynchronous (aka AJAX) parallel already? Commented Jul 18, 2011 at 22:36
  • @Diodeus it absolutely is (unless configured to be sync, of course); and because it is, handling 10/20 of these requests, their individual errors and time-outs is tedious and error-prone. That's why I'm asking whether there's a library or utility that already does that. Commented Jul 18, 2011 at 22:53

2 Answers 2

2

Use one of the flow-control libraries:

Sign up to request clarification or add additional context in comments.

1 Comment

"Step". I selected the simplest one that did the job. By simplest I mean: fewest loc to implement the requirements above, and the smallest set of features in the lib itself. "Step" won.
0

Node.js does have maxSockets. I think this library might come close to your requirements => https://github.com/SaltwaterC/http-get?

2 Comments

http-get looks interesting. I didn't find a way to have a single err for 'n' number of requests in it though. Also, I wish maxSockets wasn't global; but that's a different topic.
@Yuriy or maybe request => github.com/mikeal/request,which also is very popular.. I think coding these requirements should not be to hard to accomplish... But I also think you should search search.npmjs.org and github.com/ry/node/wiki/modules. That are just two modules. request is the most popular one and the other in my question has recently had a commit...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.