commit | f7b3c3597a1d653bb9eac26e8963020a8da1079c | [log] [tgz] |
---|---|---|
author | Kevin Moore <kevmoo@users.noreply.github.com> | Wed Mar 31 00:19:48 2021 |
committer | GitHub <noreply@github.com> | Wed Mar 31 00:19:48 2021 |
tree | 7f6e111cbc1465310e2d6801f4554486313cbd18 | |
parent | 24fb8a04befa75a94ac63a27047b231d1a22aab4 [diff] |
Update setup, test oldest supported SDK (#36)
shelf_web_socket
is a Shelf handler for establishing WebSocket connections. It exposes a single function, webSocketHandler, which calls an onConnection
callback with a WebSocketChannel 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'; import 'package:web_socket_channel/web_socket_channel.dart'; void main() { var handler = webSocketHandler((webSocket) { webSocket.stream.listen((message) { webSocket.sink.add("echo $message"); }); }); shelf_io.serve(handler, 'localhost', 8080).then((server) { print('Serving at ws://${server.address.host}:${server.port}'); }); }