OLD | NEW |
(Empty) | |
| 1 `http_throttle` is middleware for the [http package][] that throttles the number |
| 2 of concurrent requests that an HTTP client can make. |
| 3 |
| 4 ```dart |
| 5 // This client allows 32 concurrent requests. |
| 6 final client = new ThrottleClient(32); |
| 7 |
| 8 Future<List<String>> readAllUrls(Iterable<Uri> urls) { |
| 9 return Future.wait(urls.map((url) { |
| 10 // You can safely call as many client methods as you want concurrently, and |
| 11 // ThrottleClient will ensure that only 32 underlying HTTP requests will be |
| 12 // open at once. |
| 13 return client.read(url); |
| 14 })); |
| 15 } |
| 16 ``` |
| 17 |
| 18 [http package]: pub.dartlang.org/packages/http |
OLD | NEW |