public IAsyncEnumerable <CurrentConditionsReply> GetStreamingWeather(CancellationToken token)
        {
            var channel = GrpcChannel.ForAddress("http://localhost:5004");

            var client = new CurrentConditions.CurrentConditionsClient(channel);

            return(client.GetCurrentConditionStream(new CurrentConditionsRequest(), cancellationToken: token)
                   .ResponseStream.ReadAllAsync());
        }
        public async Task <RepeatedField <CurrentCondition> > GetGrpc()
        {
            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

            // The port number(5001) must match the port of the gRPC server.
            var channel = GrpcChannel.ForAddress("http://localhost:5004");

            var client = new CurrentConditions.CurrentConditionsClient(channel);
            var reply  = await client.GetCurrentConditionsAsync(new CurrentConditionsRequest()
            {
            });

            return(reply.CurrentConditions);
        }
Exemple #3
0
        static async Task Main(string[] args)
        {
            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

            // The port number(5001) must match the port of the gRPC server.
            var channel = GrpcChannel.ForAddress("http://localhost:5004");

            var client = new CurrentConditions.CurrentConditionsClient(channel);
            var reply  = await client.GetCurrentConditionsAsync(new CurrentConditionsRequest()
            {
            });

            foreach (var r in reply.CurrentConditions)
            {
                Console.WriteLine(r.Name + " is " + r.Description);
            }
            Console.ReadKey();

            GetMiddleName(new Person("First", "Last")
            {
                MiddleName = "Foo"
            });
        }