Server
Edit pageLast modified: 13 June 2025KrpcServer
KrpcServer
abstract class implements RpcServer
and all the logic for processing RPC messages and again leaves KrpcTransport
methods for the specific implementations (see transports).
Example usage with custom transport:
// same MySimpleRpcTransport as in the client example above
class MySimpleRpcServer : KrpcServer(rpcServerConfig(), MySimpleRpcTransport())
val server = MySimpleRpcServer()
server.registerService<MyService> { MyServiceImpl() }
note
Note that here we pass explicit
MyService
type parameter to theregisterService
method. You must explicitly specify the type of the service interface here, otherwise the server service will not be found.See Annotation type-safety for more details.