public AsyncServerStreamingCall <Example.HelloReply> SayHello(GrpcCancellationTokenSource ctx, Example.HelloRequest req) { return(this.invoker.AsyncServerStreamingCall <Example.HelloRequest, Example.HelloReply>( new Method <Example.HelloRequest, Example.HelloReply>( MethodType.ServerStreaming, "example.MultiGreeter", "sayHello", new ProtoMarshaller <Example.HelloRequest>(Example.HelloRequest.Parser), new ProtoMarshaller <Example.HelloReply>(Example.HelloReply.Parser) ), this.host, new CallOptions(cancellationToken: new GrpcCancellationToken(ctx)), req )); }
// Use this for initialization void Start() { var client = new Example.Client("127.0.0.1", 9991); Debug.Log("Stating calling gRPC service to greet me 10 times"); // You can setup some timeout here... var ctx = new GrpcCancellationTokenSource(); AsyncServerStreamingCall <Example.HelloReply> call = client.SayHello(ctx, new Example.HelloRequest { Name = "CuriousUser!11one!one", NumGreetings = 10 }); // Schedule response parsing in async. call.ResponseStream.MoveNext().StartAsCoroutine <bool>(this.onNextFn(call)); }