kotlinx.rpc 0.10.2 Help

Client

GrpcClient connects to a gRPC server and provides service stubs via withService.

val client = GrpcClient("localhost", 8080) { credentials = plaintext() } val recognizer = client.withService<ImageRecognizer>() val image = Image { data = byteArrayOf(0, 1, 2, 3) } val result = recognizer.recognize(image) println("Recognized category: ${result.category}") client.shutdown() client.awaitTermination()

Configuration

credentials

Sets client credentials. Use plaintext() for insecure connections (testing only) or tls { ... } for secure communication. Default TLS credentials are used when not specified.

messageMarshallerResolver

A GrpcMarshallerResolver for custom serialization. Not needed when using generated Protobuf types. See No proto.

overrideAuthority

Overrides the authority used with TLS and HTTP virtual hosting. Does not change the actual host the client connects to.

intercept(...)

Adds client-side interceptors. Interceptors are executed in the order they are added.

keepAlive { ... }

Configures keep-alive pings to detect broken connections. Disabled by default.

Lifecycle

Call shutdown() to stop accepting new calls and awaitTermination() to wait for in-flight calls to complete. Use shutdownNow() to cancel all calls immediately.

Last modified: 10 March 2026