예제 #1
0
        public IObservable <ChatLog> ChatLogs()
        {
            var call = m_client.Subscribe(new Empty());

            return(call.ResponseStream
                   .ToAsyncEnumerable() // conversion for easy to consume
                   .ToObservable()
                   .Finally(() => call.Dispose()));
        }
예제 #2
0
        static async Task Main(string[] args)
        {
            var httpHandler = new HttpClientHandler();
            // Return `true` to allow certificates th at are untrusted/invalid
            //httpHandler.ServerCertificateCustomValidationCallback =
            //    HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;

            //var channel = GrpcChannel.ForAddress(new UriBuilder("https://127.0.0.1:5001").Uri);
            var channel = GrpcChannel.ForAddress("https://*****:*****@mercury.com", UserTag = "papu", UserId = 3
                        },
                        Text      = result,
                        Timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss")
                    },
                    UserId = 1
                });
            }

            Console.WriteLine("Disconnecting");
            await request.RequestStream.CompleteAsync();

            await readTask;

            Console.ReadKey();
        }
예제 #3
0
        public IAsyncEnumerable <ChatLog> ChatLogs()
        {
            var call = m_client.Subscribe(new Empty());

            // I do not want to expose gRPC such as IAsyncStreamReader or AsyncServerStreamingCall.
            // I also do not want to bother user of this class with asking to dispose the call object.

            return(call.ResponseStream
                   .ToAsyncEnumerable()
                   .Finally(() => call.Dispose()));
        }