commit | 56338f7ce79c99d118ffaa12a6c27b5b0a507416 | [log] [tgz] |
---|---|---|
author | Patrice Chalin <chalin@users.noreply.github.com> | Tue Jul 17 21:47:38 2018 |
committer | Kevin Moore <kevmoo@users.noreply.github.com> | Tue Jul 17 21:47:38 2018 |
tree | f4e5b2cc47e26ba4c161aa3257a2af4ee02c3196 | |
parent | 0a85e41ab02d764cce74e04304c81ef005a673e6 [diff] |
chore: set max SDK version to <3.0.0 (#10)
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}'); }); }