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

Unified Diff: mojo/public/dart/third_party/shelf_web_socket/README.md

Issue 1346773002: Stop running pub get at gclient sync time and fix build bugs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 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
Index: mojo/public/dart/third_party/shelf_web_socket/README.md
diff --git a/mojo/public/dart/third_party/shelf_web_socket/README.md b/mojo/public/dart/third_party/shelf_web_socket/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..aa9379eec1dfd8b2750a387fb595bf01952ffb74
--- /dev/null
+++ b/mojo/public/dart/third_party/shelf_web_socket/README.md
@@ -0,0 +1,31 @@
+## Web Socket Handler for Shelf
+
+`shelf_web_socket` is a [Shelf][] handler for establishing [WebSocket][]
+connections. It exposes a single function, [webSocketHandler][], which calls an
+`onConnection` callback with a [CompatibleWebSocket][] object for every
+connection that's established.
+
+[Shelf]: https://pub.dartlang.org/packages/shelf
+
+[WebSocket]: https://tools.ietf.org/html/rfc6455
+
+[webSocketHandler]: https://api.dartlang.org/apidocs/channels/be/dartdoc-viewer/shelf_web_socket/shelf_web_socket.webSocketHandler
+
+[CompatibleWebSocket]: https://api.dartlang.org/apidocs/channels/be/dartdoc-viewer/http_parser/http_parser.CompatibleWebSocket
+
+```dart
+import 'package:shelf/shelf_io.dart' as shelf_io;
+import 'package:shelf_web_socket/shelf_web_socket.dart';
+
+void main() {
+ var handler = webSocketHandler((webSocket) {
+ webSocket.listen((message) {
+ webSocket.add("echo $message");
+ });
+ });
+
+ shelf_io.serve(handler, 'localhost', 8080).then((server) {
+ print('Serving at ws://${server.address.host}:${server.port}');
+ });
+}
+```

Powered by Google App Engine
This is Rietveld 408576698