Implement the server side - Xenoage/RpcLib GitHub Wiki

  1. Like on the client side, we also need "stubs" on the server side. See the examples DemoClientRpcStub and CalcRpcStub.
  2. Implement the server interfaces with the "real" logic. See the example DemoServerRpc. Within the method calls, you can use the property Context to query the calling client's ID and a service factory to use ASP.NET Core dependency injection (see the method SayHelloToServer for an example).
  3. Initialize the RPC library on the server side (see example Startup, the lines after // RPC initialization ):
    • Call the RpcInit.InitRpcServer method (or by extension method style on the services) for instantiating the RPC engine, using the ASP.NET Core services, an authentication method (e.g. HTTP Basic Auth) and a list of the types of the implementations of your server-side methods.
  4. To call the clients, create instances of your client stubs and call their methods. To get a list of the currently connected client IDs, call RpcMain.GetClientIDs()

That's it. Happy coding. Feel free to ask if something is not clear, so we can improve this tutorial.