bidirectionalStream

inline suspend fun <S : Any, R : Any> GrpcStreamingCall<S, R>.bidirectionalStream(scope: CoroutineScope, crossinline block: suspend (SendChannel<S>, ReceiveChannel<R>) -> Unit): ReceiveChannel<R>

Executes a Bidirectional Streaming RPC call In this use case, you are free to interleave request and response messages. The caller can optionally send and receive messages in the supplied block or after the block completes in the returned ReceiveChannel.

Return

The ReceiveChannel that will receive the server's streaming response. The caller can optionally consume server responses from this channel.

Parameters

scope

The CoroutineScope to use for the call. This will be used to create coroutines that will write the requests to the client message sync. It will also be the context for calling the block function.

block

A function that will be called with a SendChannel and ReceiveChannel that the caller can use to send requests to the server and consume responses from the server. The send channel will automatically be closed when the block completes.