RemoteClient.fromJsonChannel constructor

RemoteClient.fromJsonChannel(
  1. StreamChannel<Map<String, Object?>> channel,
  2. CloseWithReason closeWithReason,
  3. String protocol
)

Implementation

RemoteClient.fromJsonChannel(
  this.channel,
  this.closeWithReason,
  this.protocol,
) {
  _ctrl.local.stream.map((m) => m.toJson()).forEach(channel.sink.add);
  channel.stream.listen(
    (m) => _ctrl.local.sink.add(OperationMessage.fromJson(m)),
    onDone: _ctrl.local.sink.close,
  );
}