Implementing RPC Without Server
Diarkis C# client offers RPC class to help you implement client-to-client RPC without having to code server-side logic at all.
What Is RPC?
An RPC – Remote Procedure Call is a technique that allows remote computers to invoke and execute computational operations as if it were a normal procedure. Typically used for client-to-server-based applications.
Why Is This Useful?
With Diarkis RPC, you may implement features that require remote computing without adding server logic at all. In some cases, you might not have access to the server or you simply do not have server-side engineers. The ability to complete remote computing features with the client-side only could be useful.
Implementation Example
Diarkis RPC class uses the Room module as its communication broker for RPC.
How To Set Up RPC Class
How To Register An RPC method
In order to execute specific RPC logic, you must “register” methods that implement RPC logic.
How To Invoke An RPC
The example below will invoke an RPC on all clients:
The example below will invoke an RPC on selected clients:
NOTE: The returned value bool “called” indicates the RPC has been called, but it does not mean the remote client has received the call and executed the call.