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

Side by Side Diff: README.md

Issue 1318033004: Fix a link to shelf in the README. (Closed) Base URL: git@github.com:dart-lang/shelf_web_socket@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
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ## Web Socket Handler for Shelf 1 ## Web Socket Handler for Shelf
2 2
3 `shelf_web_socket` is a [Shelf][] handler for establishing [WebSocket][] 3 `shelf_web_socket` is a [Shelf][] handler for establishing [WebSocket][]
4 connections. It exposes a single function, [webSocketHandler][], which calls an 4 connections. It exposes a single function, [webSocketHandler][], which calls an
5 `onConnection` callback with a [CompatibleWebSocket][] object for every 5 `onConnection` callback with a [CompatibleWebSocket][] object for every
6 connection that's established. 6 connection that's established.
7 7
8 [Shelf]: pub.dartlang.org/packages/shelf 8 [Shelf]: https://pub.dartlang.org/packages/shelf
9 9
10 [WebSocket]: https://tools.ietf.org/html/rfc6455 10 [WebSocket]: https://tools.ietf.org/html/rfc6455
11 11
12 [webSocketHandler]: https://api.dartlang.org/apidocs/channels/be/dartdoc-viewer/ shelf_web_socket/shelf_web_socket.webSocketHandler 12 [webSocketHandler]: https://api.dartlang.org/apidocs/channels/be/dartdoc-viewer/ shelf_web_socket/shelf_web_socket.webSocketHandler
13 13
14 [CompatibleWebSocket]: https://api.dartlang.org/apidocs/channels/be/dartdoc-view er/http_parser/http_parser.CompatibleWebSocket 14 [CompatibleWebSocket]: https://api.dartlang.org/apidocs/channels/be/dartdoc-view er/http_parser/http_parser.CompatibleWebSocket
15 15
16 ```dart 16 ```dart
17 import 'package:shelf/shelf_io.dart' as shelf_io; 17 import 'package:shelf/shelf_io.dart' as shelf_io;
18 import 'package:shelf_web_socket/shelf_web_socket.dart'; 18 import 'package:shelf_web_socket/shelf_web_socket.dart';
19 19
20 void main() { 20 void main() {
21 var handler = webSocketHandler((webSocket) { 21 var handler = webSocketHandler((webSocket) {
22 webSocket.listen((message) { 22 webSocket.listen((message) {
23 webSocket.add("echo $message"); 23 webSocket.add("echo $message");
24 }); 24 });
25 }); 25 });
26 26
27 shelf_io.serve(handler, 'localhost', 8080).then((server) { 27 shelf_io.serve(handler, 'localhost', 8080).then((server) {
28 print('Serving at ws://${server.address.host}:${server.port}'); 28 print('Serving at ws://${server.address.host}:${server.port}');
29 }); 29 });
30 } 30 }
31 ``` 31 ```
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698