Fix _BinaryFunction typedef to only check arity (#12)

Fixes #11

Update to the new Function syntax and drop the comment which effectively
only repeats the name.
3 files changed
tree: 68c58f361dbb8bd2cb6517c41b6cd17d81870ddc
  1. lib/
  2. test/
  3. .gitignore
  4. .test_config
  5. .travis.yml
  6. CHANGELOG.md
  7. codereview.settings
  8. LICENSE
  9. pubspec.yaml
  10. README.md
README.md

Web Socket Handler for Shelf

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}');
  });
}