serverStream<I, O> function

Stream<O> serverStream<I, O>(
  1. Transport transport,
  2. Method method,
  3. I request,
  4. Codec<I> input,
  5. Codec<O> output, {
  6. CallOptions options = const CallOptions(),
})

Implementation

Stream<O> serverStream<I, O>(Transport transport, Method method, I request,
    Codec<I> input, Codec<O> output,
    {CallOptions options = const CallOptions()}) async* {
  final call = await transport.open(method, options: options);
  try {
    await call.send(input.encode(request));
    await call.halfClose();
    while (true) {
      final bytes = await call.recv();
      if (bytes == null) return;
      yield output.decode(bytes);
    }
  } finally {
    await call.close();
  }
}