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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 ## Web Socket Handler for Shelf
2
3 `shelf_web_socket` is a [Shelf][] handler for establishing [WebSocket][]
4 connections. It exposes a single function, [webSocketHandler][], which calls an
5 `onConnection` callback with a [CompatibleWebSocket][] object for every
6 connection that's established.
7
8 [Shelf]: https://pub.dartlang.org/packages/shelf
9
10 [WebSocket]: https://tools.ietf.org/html/rfc6455
11
12 [webSocketHandler]: https://api.dartlang.org/apidocs/channels/be/dartdoc-viewer/ shelf_web_socket/shelf_web_socket.webSocketHandler
13
14 [CompatibleWebSocket]: https://api.dartlang.org/apidocs/channels/be/dartdoc-view er/http_parser/http_parser.CompatibleWebSocket
15
16 ```dart
17 import 'package:shelf/shelf_io.dart' as shelf_io;
18 import 'package:shelf_web_socket/shelf_web_socket.dart';
19
20 void main() {
21 var handler = webSocketHandler((webSocket) {
22 webSocket.listen((message) {
23 webSocket.add("echo $message");
24 });
25 });
26
27 shelf_io.serve(handler, 'localhost', 8080).then((server) {
28 print('Serving at ws://${server.address.host}:${server.port}');
29 });
30 }
31 ```
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698