static async Task Main(string[] args) { var p = NManager.CreateClientProxy <IService>(new GrpcClientOptions { Host = "localhost", Port = 50001 }); await p.Proxy.Call(async i => Console.WriteLine($"receive callback: {i}")); Console.Read(); }
static async Task Main(string[] args) { var p = NManager.CreateClientProxy <IService>(new GrpcClientOptions { Host = "lj", Port = 50001 }); await p.Proxy.Call("hello world."); Console.Read(); }
static async Task Main(string[] args) { _proxyAsync = NManager.CreateClientProxy <IServiceAsync>(new HttpClientOptions { SignalRHubUrl = "http://localhost:5000/callback", ApiUrl = "http://localhost:5000/api" }).Proxy; await Test_CallAsync(); await Test_CallByCancelAsync(); await Test_CallByCustomExceptionAsync(); await Test_CallByDefaultExceptionAsync(); await Test_CallByResponseTextExceptionAsync(); await Test_ComplexCallAsync(); Console.Read(); }
static async Task Main(string[] args) { HttpClient c = new HttpClient(); var res = await c.GetAsync("http://localhost:5000/11"); //var p = NManager.CreateClientProxy<IService>(new Channel("localhost", 5000, ChannelCredentials.Insecure)); var p = NManager.CreateClientProxy <IService>(new GrpcClientOptions() { Host = "localhost", Port = 5001, PublicKey = PublicKey }); //await p.Proxy.Call("hello world."); var channel = new Channel("localhost", 5000, ChannelCredentials.Insecure); var client = new Greeter.GreeterClient(channel); var r = await client.SayHelloAsync(new HelloRequest() { Name = "n1" }); Console.Read(); }
static async Task Main(string[] args) { var proxy = NManager.CreateClientProxy <IServiceAsync>(Helper.GetMQOptions()).Proxy; for (var i = 0; i < 10; i++) { var i1 = i; Task.Run(async() => { Console.WriteLine($"Send {i1}"); await proxy.CallAsync(async p => Console.WriteLine(p), i1.ToString()); }); } //for (int i = 0; i < 10; i++) //{ // using (var stream = File.Open(Helper.GetTestFilePath(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) // await proxy.PostAsync(i.ToString(), stream); // Console.WriteLine($"post {i}"); //} Console.WriteLine("Send end"); Console.Read(); }