ServiceModel.Grpc

Code-first for gRPC

View on GitHub

Client streaming operation

[OperationContract]
[Task<TResult>|Task] OperationName(IAsyncEnumerable<TData> stream, [T1 arg1, T2 arg2, ..., TN argN], [CancellationToken|CallContext context]);

[OperationContract]
[ValueTask<TResult>|ValueTask] OperationName(IAsyncEnumerable<TData> stream, [T1 arg1, T2 arg2, ..., TN argN], [CancellationToken|CallContext context]);

The gRPC protocol does not support input parameters. The only way to pass them to server is by using request headers. In case the operation contains external input ([T1 arg1, T2 arg2, …, TN argN]), ServiceModel.Grpc framework will automatically:

for example:

// standard gRPC client streaming call
[OperationContract]
Task<int> MultiplyBy2(IAsyncEnumerable<int> values);

// here multiplier value will be automatically passed in the binary request header
[OperationContract]
Task<int> MultiplyBy(IAsyncEnumerable<int> values, int multiplier);