예제 #1
0
        private static async Task RunFeedMe(GreeterClient client)
        {
            var feedMeRequest = client.FeedMe();
            var random        = client.GetRandomNumberStream(new Empty());


            await foreach (var item in random.ResponseStream.ToEnumerable())
            {
                await feedMeRequest.RequestStream.WriteAsync(new FoodMessage { Value = item.Number });

                await Task.Delay(2000);
            }

            await feedMeRequest.RequestStream.CompleteAsync();

            var result = await feedMeRequest.ResponseAsync;

            Console.WriteLine(result.Message);
            Console.WriteLine(result.Total);
            Console.WriteLine(string.Join(',', result.AllValues));
        }