MB.TinyRpc
1.10.0
See the version list below for details.
dotnet add package MB.TinyRpc --version 1.10.0
NuGet\Install-Package MB.TinyRpc -Version 1.10.0
<PackageReference Include="MB.TinyRpc" Version="1.10.0" />
paket add MB.TinyRpc --version 1.10.0
#r "nuget: MB.TinyRpc, 1.10.0"
// Install MB.TinyRpc as a Cake Addin #addin nuget:?package=MB.TinyRpc&version=1.10.0 // Install MB.TinyRpc as a Cake Tool #tool nuget:?package=MB.TinyRpc&version=1.10.0
MB.TinyRpc
TinyRpc
is a small, fast 1:1 RPC client-server framework that uses source generation to communicate using binary data over pipes.
It sends as little data as necessary, without run-time checks. If the common interface doesn't have events, for example, the machinery to support them isn't generated. Similarly, void
returns or parameters don't send anything over the pipe.
It also automatically starts the server when the client is instantiated and it automatically closes the server when the client shuts down (even if it doesn't shut down gracefully). There is no possibility of getting out-of-sync orphaned servers.
Support
Type | .NET | Windows C++ |
---|---|---|
Server | ✅ | ❌ |
Client | ✅ | ✅ |
Common interface definition
The source of any operation is a .Net interface that can contain methods or events. This interface doesn't have to be a single common type as long as the definition matches. For example, in the sample provided it's used in a shared project (thus creating two different types):
internal interface IServer
{
void Hi();
void FancyHi(string name, int age);
int Add(int x, int y);
byte[] BufferCall(byte[] baseUtf8String, int n);
(int a, int b, short c, byte[] utf8) GetValueTupleResult(string s);
(uint a, long b, DateTime dt, double d)[] GetValueTupleArrayResult();
event Action<double, string> OnData;
}
.NET Server
The pattern for creating a .NET server is as follows:
- Reference
MB.TinyRpc
. - Instantiate the interface to a concrete class that handles the functions as needed.
- Create a new partial class and decorate it with
[TinyRpcServerClass(typeof(ServerHandler))]
, whereServerHandler
is your concrete class name. - Instantiate the server class above in code. This will create the listener on your thread pool and keep the
IsHealthy
property up to date.
You can find an example of this here.
.NET Client
The pattern for creating a .NET client is as follows:
- Reference
MB.TinyRpc
. - Create a partial class and decorate it with
[TinyRpcClientClass(typeof(IServer))]
, whereIServer
is the common interface above. - Instantiate the class and call the provided
async
functions on it, or fire its events.
You can find an example of this here.
C++ Client
- Reference
MB.TinyRpc.CppGen
. - Add a pre-build event that calls the code generator on the .Net client project to extract information about the interface type and build the C++ header file:
"$(ProjectDir)TinyRpcCppGen\tinyRpc.CppGen.exe" --input-project-path "$(SolutionDir)SampleClient\SampleClient.csproj" --input-class-names "SampleShared.IServer" --output-path "$(ProjectDir)TinyRpcServer.h" --output-class-names "TinyRpcServer"
- Include the generated header file and call its functions or fire its events.
You can find an example of this here.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- MB.TinyRpc.Roslyn (>= 1.10.0)
- Microsoft.Extensions.ObjectPool (>= 7.0.13)
- Nito.AsyncEx.Coordination (>= 5.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.13.0 | 92 | 9/30/2024 |
1.12.0 | 81 | 9/30/2024 |
1.11.0 | 85 | 9/29/2024 |
1.10.0 | 362 | 3/15/2024 |
1.9.0 | 260 | 11/5/2023 |
1.8.0 | 160 | 11/2/2023 |
1.7.0 | 152 | 10/31/2023 |
1.6.2 | 147 | 10/31/2023 |
1.6.0 | 145 | 10/31/2023 |
1.5.0 | 133 | 10/28/2023 |
1.4.0 | 162 | 10/4/2023 |
1.3.0 | 130 | 10/3/2023 |
1.2.0 | 148 | 10/3/2023 |
1.1.0 | 143 | 10/3/2023 |
1.0.0 | 149 | 10/3/2023 |