tag | b24ab86f5ab1b1a27eda96ac18e40dda2d92bc92 | |
---|---|---|
tagger | Kevin Moore <kevmoo@google.com> | Fri Jun 01 16:20:45 2018 |
object | 0a85e41ab02d764cce74e04304c81ef005a673e6 |
commit | 0a85e41ab02d764cce74e04304c81ef005a673e6 | [log] [tgz] |
---|---|---|
author | Lasse R.H. Nielsen <lrn@google.com> | Fri Jun 01 16:20:00 2018 |
committer | Kevin Moore <kevmoo@users.noreply.github.com> | Fri Jun 01 16:20:00 2018 |
tree | 52e605edd78f400a8b8d693d89106506834df52c | |
parent | 107c31292fa1c7d39231943ed8a1fb827c53e452 [diff] |
Fix deprecated constant. (#9)
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}'); }); }