Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Unified Diff: pkg/http_throttle/README.md

Issue 418103004: Add an http_throttle package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/http_throttle/LICENSE ('k') | pkg/http_throttle/lib/http_throttle.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http_throttle/README.md
diff --git a/pkg/http_throttle/README.md b/pkg/http_throttle/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..fcbacdbba0c29bd5c0ec4fbaa3ed0a828614124f
--- /dev/null
+++ b/pkg/http_throttle/README.md
@@ -0,0 +1,18 @@
+`http_throttle` is middleware for the [http package][] that throttles the number
+of concurrent requests that an HTTP client can make.
+
+```dart
+// This client allows 32 concurrent requests.
+final client = new ThrottleClient(32);
+
+Future<List<String>> readAllUrls(Iterable<Uri> urls) {
+ return Future.wait(urls.map((url) {
+ // You can safely call as many client methods as you want concurrently, and
+ // ThrottleClient will ensure that only 32 underlying HTTP requests will be
+ // open at once.
+ return client.read(url);
+ }));
+}
+```
+
+[http package]: pub.dartlang.org/packages/http
« no previous file with comments | « pkg/http_throttle/LICENSE ('k') | pkg/http_throttle/lib/http_throttle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698