commit | 703923a7a241fbe24de3ed15d4f235aee0eb4f97 | [log] [tgz] |
---|---|---|
author | Nate Bosch <nbosch1@gmail.com> | Mon Aug 06 19:37:18 2018 |
committer | GitHub <noreply@github.com> | Mon Aug 06 19:37:18 2018 |
tree | 68c58f361dbb8bd2cb6517c41b6cd17d81870ddc | |
parent | 56338f7ce79c99d118ffaa12a6c27b5b0a507416 [diff] |
Fix _BinaryFunction typedef to only check arity (#12) Fixes #11 Update to the new Function syntax and drop the comment which effectively only repeats the name.
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}'); }); }