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

Side by Side Diff: pkg/shelf_web_socket/README.md

Issue 297593003: Add a shelf_web_socket package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixes Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « pkg/shelf_web_socket/LICENSE ('k') | pkg/shelf_web_socket/lib/shelf_web_socket.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]: 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
« no previous file with comments | « pkg/shelf_web_socket/LICENSE ('k') | pkg/shelf_web_socket/lib/shelf_web_socket.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698