Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/beetlex-io/xrpc
- Owner: beetlex-io
- License: apache-2.0
- Created: 2019-05-14T06:23:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T09:51:30.000Z (about 2 years ago)
- Last Synced: 2024-10-11T14:09:28.036Z (3 months ago)
- Topics: dotnet, dotnetcore, rpc-api, rpc-client, rpc-framework, rpc-server, tcp
- Language: C#
- Homepage:
- Size: 129 KB
- Stars: 84
- Watchers: 6
- Forks: 22
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
``` csharppublic 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);
}
```