commit | b38b9c57fcf0f9d6fd1b3f8ef427abcf4a87e7d6 | [log] [tgz] |
---|---|---|
author | Keerti Parthasarathy <keertip@google.com> | Thu Sep 28 11:26:24 2017 -0700 |
committer | Keerti Parthasarathy <keertip@google.com> | Thu Sep 28 11:26:24 2017 -0700 |
tree | 8d5450c0c8c85432bf6740e183aefbb0179a85a2 | |
parent | e49a44d4c0d25dc2396a084752b4f838d55e6a68 [diff] |
Make package strong, also add analysis options file
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.
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}'); }); }