Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/beetlex-io/xrpc

dotnet high performance remote interface and delegate invoke(RPC) communication components,support millions RPS remote interface method invokes
https://github.com/beetlex-io/xrpc

dotnet dotnetcore rpc-api rpc-client rpc-framework rpc-server tcp

Last synced: 2 months ago
JSON representation

dotnet high performance remote interface and delegate invoke(RPC) communication components,support millions RPS remote interface method invokes

Awesome Lists containing this project

README

        

# 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
``` csharp
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
``` csharp

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

[Service(typeof(IHello))]
public class HelloImpl : IHello
{
public Task Hello(string name)
{
return $"hello {name} {DateTime.Now}".ToTask();
}
}
```
## Client
``` csharp
client = new XRPCClient("localhost", 9090);
client.Options.ParameterFormater = new JsonPacket();//default messagepack
hello = client.Create();
while(true)
{
Console.Write("Enter you name:");
var name = Console.ReadLine();
var task = hello.Hello(name);
task.Wait();
Console.WriteLine(task.Result);
}
```