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

Unified Diff: README.md

Issue 1758053002: Add a top-level status library. (Closed) Base URL: git@github.com:dart-lang/web_socket_channel.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | lib/status.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: README.md
diff --git a/README.md b/README.md
index 3e984aa875ac14e149f1b365db37605c8f0a69f1..2ea4408dd8d393d32472095a7bb2669dea39e545 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,26 @@ class, and [a similar implementation][HtmlWebSocketChannel] that wrap's
[IOWebSocketChannel]: https://www.dartdocs.org/documentation/web_socket_channel/latest/io/IOWebSocketChannel-class.html
[HtmlWebSocketChannel]: https://www.dartdocs.org/documentation/web_socket_channel/latest/html/HtmlWebSocketChannel-class.html
+It also provides constants for the WebSocket protocol's pre-defined status codes
+in the [`status.dart` library][status]. It's strongly recommended that users
+import this library should be imported with the prefix `status`.
+
+[status]: https://www.dartdocs.org/documentation/web_socket_channel/latest/status/status-library.html
+
+```dart
+import 'package:web_socket_channel/io.dart';
+import 'package:web_socket_channel/status.dart' as status;
+
+main() async {
+ var channel = await IOWebSocketChannel.connect("ws://localhost:1234");
+
+ channel.stream.listen((message) {
+ channel.sink.add("received!");
+ channel.close(status.goingAway);
+ });
+}
+```
+
## `WebSocketChannel`
The [`WebSocketChannel`][WebSocketChannel] class's most important role is as the
« no previous file with comments | « no previous file | lib/status.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698