Skip to content
dotnet high performance remote interface invoke(RPC) communication components,implemente millions RPS remote interface method invokes
C#
Branch: master
Clone or download
Latest commit 2708fa7 Jan 9, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
samples add samples Jan 9, 2020
src no message Jan 8, 2020
LICENSE Create LICENSE May 14, 2019
README.md Update README.md Jan 8, 2020
test_report.png Add files via upload May 15, 2019

README.md

XRPC

dotnet high performance remote interface invoke(RPC) communication components,implemente millions RPS remote interface method calls.

samples

https://github.com/IKende/BeetleX-Samples

Install Packet

Install-Package BeetleX.XRPC -Version x

Server

    class Program
    {
        static void Main(string[] args)
        {
            var builder = new HostBuilder()
            .ConfigureServices((hostContext, services) =>
            {
                services.UseXRPC(s =>
                {
                    s.ServerOptions.LogLevel = BeetleX.EventArgs.LogType.Trace;
                    s.ServerOptions.DefaultListen.Port = 9090;
                    s.RPCOptions.ParameterFormater = new JsonPacket();//default messagepack
                },
                    typeof(Program).Assembly);
            });
            builder.Build().Run();
        }
    }

Server controller

    public interface IHello
    {
        Task<string> Hello(string name);
    }

    [Service(typeof(IHello))]
    public class HelloImpl : IHello
    {
        public Task<string> Hello(string name)
        {
            return $"hello {name} {DateTime.Now}".ToTask();
        }
    }

Client

            client = new XRPCClient("localhost", 9090);
            client.Options.ParameterFormater = new JsonPacket();//default messagepack
            hello = client.Create<IHello>();
            while(true)
            {
                Console.Write("Enter you name:");
                var name = Console.ReadLine();
                var task = hello.Hello(name);
                task.Wait();
                Console.WriteLine(task.Result);
            }
You can’t perform that action at this time.