diff options
Diffstat (limited to 'src/csharp/Grpc.Examples/MathGrpc.cs')
-rw-r--r-- | src/csharp/Grpc.Examples/MathGrpc.cs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index 24e6a1de8e..60408b9018 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -82,11 +82,11 @@ namespace math Task<DivReply> DivAsync(DivArgs request, CancellationToken token = default(CancellationToken)); - void Fib(FibArgs request, IObserver<Num> responseObserver, CancellationToken token = default(CancellationToken)); + AsyncServerStreamingCall<Num> Fib(FibArgs request, CancellationToken token = default(CancellationToken)); - ClientStreamingAsyncResult<Num, Num> Sum(CancellationToken token = default(CancellationToken)); + AsyncClientStreamingCall<Num, Num> Sum(CancellationToken token = default(CancellationToken)); - IObserver<DivArgs> DivMany(IObserver<DivReply> responseObserver, CancellationToken token = default(CancellationToken)); + AsyncDuplexStreamingCall<DivArgs, DivReply> DivMany(CancellationToken token = default(CancellationToken)); } public class MathServiceClientStub : AbstractStub<MathServiceClientStub, StubConfiguration>, IMathServiceClient @@ -111,35 +111,35 @@ namespace math return Calls.AsyncUnaryCall(call, request, token); } - public void Fib(FibArgs request, IObserver<Num> responseObserver, CancellationToken token = default(CancellationToken)) + public AsyncServerStreamingCall<Num> Fib(FibArgs request, CancellationToken token = default(CancellationToken)) { var call = CreateCall(ServiceName, FibMethod); - Calls.AsyncServerStreamingCall(call, request, responseObserver, token); + return Calls.AsyncServerStreamingCall(call, request, token); } - public ClientStreamingAsyncResult<Num, Num> Sum(CancellationToken token = default(CancellationToken)) + public AsyncClientStreamingCall<Num, Num> Sum(CancellationToken token = default(CancellationToken)) { var call = CreateCall(ServiceName, SumMethod); return Calls.AsyncClientStreamingCall(call, token); } - public IObserver<DivArgs> DivMany(IObserver<DivReply> responseObserver, CancellationToken token = default(CancellationToken)) + public AsyncDuplexStreamingCall<DivArgs, DivReply> DivMany(CancellationToken token = default(CancellationToken)) { var call = CreateCall(ServiceName, DivManyMethod); - return Calls.DuplexStreamingCall(call, responseObserver, token); + return Calls.AsyncDuplexStreamingCall(call, token); } } // server-side interface public interface IMathService { - void Div(DivArgs request, IObserver<DivReply> responseObserver); + Task<DivReply> Div(DivArgs request); - void Fib(FibArgs request, IObserver<Num> responseObserver); + Task Fib(FibArgs request, IServerStreamWriter<Num> responseStream); - IObserver<Num> Sum(IObserver<Num> responseObserver); + Task<Num> Sum(IAsyncStreamReader<Num> requestStream); - IObserver<DivArgs> DivMany(IObserver<DivReply> responseObserver); + Task DivMany(IAsyncStreamReader<DivArgs> requestStream, IServerStreamWriter<DivReply> responseStream); } public static ServerServiceDefinition BindService(IMathService serviceImpl) |