A lightweight and ultra-flexible RPC framework for .NET Standard 2.0.
When a member call is intercepted, we gather the information needed to replicate the unique member change, and emit an IRemoteMemberMessage, which is handled by you.
By transferring this information out and applying the instructions on another machine in the same order, you can effectively control that instance remotely.
By serializing this information and replaying it later, you can effectively record and play back all the member changes.
See the Docs for more.
using OwlCore.Remoting;
// These attribute can be applied to a specific property/method, or an entire class.
// It even works when MemberRemote is in a base class!
[RemoteProperty]
[RemoteMethod]
[RemoteOptions(RemotingDirection.ClientToHost)]
public class MyClass : IDisposable
{
private MemberRemote _memberRemote;
public MemberRemote()
{
// Pass the instance you want to remote into MemberRemote() with an ID that is identical on both machines for that instance.
// An instance will not receive member changes until you do this.
// Optionally leave out the message handler. Uses the default set by MemberRemote.SetDefaultMessageHandler(handler);
_memberRemote = new MemberRemote(this, "InstanceIdThatMatchesOnBothMachines", myMessageHandler);
}
// When the property setter is called, the value is captured and the property setter is invoked remotely.
[RemoteProperty, RemoteOptions(RemotingDirection.Bidirectional)]
public int CurrentIndex { get; set; }
// Method will be called remotely, including parameters.
[RemoteMethod, RemoteOptions(RemotingDirection.InboundHost | RemotingDirection.Outbound)]
public void SomeMethod(int data, string[] moreData)
{
// code here ...
// Execution may complete before other machines are done.
// If you need to wait for other machines to finish execution, use the _memberRemote.RemoteWaitAsync() and _memberRemote.RemoteReleaseAsync() extension methods.
}
public void Dispose()
{
// Dispose of the MemberRemote when finished. Forgetting to do this WILL result in a memory leak.
_memberRemote.Dispose();
}
}
Published releases are available on NuGet. To install, run the following command in the Package Manager Console.
PM> Install-Package OwlCore.Remoting
Or using dotnet
> dotnet add package OwlCore.Remoting
We accept donations here and here, and we do not have any active bug bounties.
Version numbering follows the Semantic versioning approach. However, if the major version is 0
, the code is considered alpha and breaking changes may occur as a minor update.
All OwlCore code is licensed under the MIT License. OwlCore is licensed under the MIT License. See the LICENSE file for more details.