commit | af1e0aac386fcd59f4f65c920f27af71a1510354 | [log] [tgz] |
---|---|---|
author | Nate Bosch <nbosch1@gmail.com> | Wed Mar 27 19:04:22 2019 |
committer | GitHub <noreply@github.com> | Wed Mar 27 19:04:22 2019 |
tree | cf4785ddf0e57e633deeb7c26a01b3a67de62f4a | |
parent | ff16a509f998efd4fa895d37afee4c3ca3f8afc5 [diff] |
Allow stream_channel version 2.x (#18) Although there are no imports to `stream_channel` from this package we do use some of the APIs. None of those apis are impacted by the planned breaking changes in `stream_channel`. - Extend range for `stream_channel`. - Correct style on other constraints. - Expand description.
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.stream.listen((message) { webSocket.add("echo $message"); }); }); shelf_io.serve(handler, 'localhost', 8080).then((server) { print('Serving at ws://${server.address.host}:${server.port}'); }); }