Fix a Dart 2 runtime error in the README (#31)
Closes #30
diff --git a/README.md b/README.md
index e495264..0567d20 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,11 @@
main() async {
var socket = IOWebSocketChannel.connect('ws://localhost:4321');
- var server = new json_rpc.Server(socket);
+
+ // The socket is a StreamChannel<dynamic> because it might emit binary
+ // List<int>s, but JSON RPC 2 only works with Strings so we assert it only
+ // emits those by casting it.
+ var server = new json_rpc.Server(socket.cast<String>());
// Any string may be used as a method name. JSON-RPC 2.0 methods are
// case-sensitive.