tag | e540412daffe041b0bcf5dcc93f34f5fc377ed2a | |
---|---|---|
tagger | Kevin Moore <kevmoo@google.com> | Tue May 15 20:21:24 2018 |
object | 107c31292fa1c7d39231943ed8a1fb827c53e452 |
commit | 107c31292fa1c7d39231943ed8a1fb827c53e452 | [log] [tgz] |
---|---|---|
author | Lasse R.H. Nielsen <lrn@google.com> | Tue May 15 20:20:08 2018 |
committer | Kevin Moore <kevmoo@users.noreply.github.com> | Tue May 15 20:20:08 2018 |
tree | 5b91ed2d7d9725b1defd812ca78450cd1b8f9468 | |
parent | 8cbd4e1aff926a395475640f3ebc29437328703d [diff] |
Remove upper case constants (#6)
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}'); }); }