commit | 8050a55b16faa5052a3e5d7dcdc170c59b6644f2 | [log] [tgz] |
---|---|---|
author | Kevin Moore <kevmoo@users.noreply.github.com> | Fri Dec 13 18:52:40 2019 |
committer | Nate Bosch <nbosch1@gmail.com> | Fri Dec 13 18:52:40 2019 |
tree | f2ca23188071cbc8174cce8df777b67bbc4c36b0 | |
parent | ed1dfc14e353548527b9292862cc1000175cb350 [diff] |
Fix newly enforced package:pedantic lints (#24) - prefer_single_quotes Drop unused author field pubspec.
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}'); }); }