I'm trying to connect to a json_rpc server in Chrome 62 on DDC 1.24.2 using the standard json_rpc_2 pub package. I'm following the Client based example found at: https://github.com/dart-lang/json_rpc_2#client.
The example fails on the analysis phase (1). What appears to be the best fix fails at runtime (2).
var socket = new HtmlWebSocketChannel.connect(address);
// (1) analysis error: The argument type 'HtmlWebSocketChannel' can't be assigned to the parameter type 'StreamChannel<String>'
_client = new json_rpc.Client(socket);
// (2) runtime error: found = "HtmlWebSocketChannel" expected = "StreamChannel<String>", type = class StreamChannel
_client = new json_rpc.Client(socket.cast<String>());
The solution seems like it should be simple, but I'm not seeing \ finding it. Any help is appreciated. Thanks!
UPDATE 12/5/2017
Instead of a runtime error in Chromium (DartVM) we'd get an infinite hang. Watching network traffic I could see, it just never sent anything. I was unable to get any of the example code to run off their repo.
I ran some tests on just the socket / HtmlWebSocketChannel and I got it sending plain text messages back and forth.
So, I just rolled my own json rpc client. That leaves the original problem unsolved, but the library used in the question appears to have other problems in addition to this. That doesn't really invalidate the question, and I'll leave it here just in case.