Client.withoutJson constructor

Client.withoutJson(StreamChannel channel)

Creates a Client that communicates using decoded messages over channel.

Unlike new Client, this doesn't read or write JSON strings. Instead, it reads and writes decoded maps or lists.

Note that the client won't begin listening to responses until Client.listen is called.

Implementation

Client.withoutJson(StreamChannel channel)
    : _manager = new ChannelManager("Client", channel) {
  _manager.done.whenComplete(() {
    for (var request in _pendingRequests.values) {
      request.completer.completeError(
          new StateError(
              'The client closed with pending request "${request.method}".'),
          StackTrace.current);
    }
    _pendingRequests.clear();
  }).catchError((_) {
    // Avoid an unhandled error.
  });
}