Implement the client side - Xenoage/RpcLib GitHub Wiki

  1. On the client side, a so called "stub" for each server interface is needed. Within this stub class, the method calls are simply encoded and forwarded to the RPC engine, which runs the commands on the server and returns the results to the caller. See the examples DemoServerRpcStub and CalcRpcStub how to implement a stub (this is just boilerplate code; we could auto-generate it in a later version of this library from the interface!).
  2. Implement the client interfaces with the "real" logic. See the examples DemoClientRpc and CalcRpc.
  3. Initialize the RPC library on the client side (see example Program, the lines after // RPC initialization ):
    • Create instances of your server stub classes and use them wherever you want to call the server.
    • Call the RpcInit.InitRpcClient method for instantiating the RPC engine, using your client configuration (including the unique client ID and the URL of the server endpoint), an authentication method (e.g. HTTP Basic Auth) and a factory method which returns the concrete implementations of your client-side methods.

Proceed with implementing the server side.