RPC Clients
For each declared service, kotlinx.rpc
will generate an actual client implementation that can be used to send requests to a server. This generated instance is commonly called a stub in RPC.
To be able to get an instance of your service, you need to have an RpcClient
. You can call the withService()
method on your client:
Now you have your client instance that is able to send RPC requests to your server. RpcClient
can have multiple services that communicate through it. Conceptually, RpcClient
is an abstraction of a client, that is able to convent service requests (represented by the RpcCall
class) into actual network requests.
You can provide your own implementations of the RpcClient
. But kotlinx.rpc
already provides one out-of-the-box solution that uses in-house RPC protocol (called kRPC), and we are working on supporting more protocols (see Configuration).