From 0d4e6b72cd7955f401545c673b79fef111e98739 Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Mon, 14 Jul 2025 15:03:45 +0200 Subject: [PATCH] Docs for gRPC with Ktor #393 --- docs/pages/kotlinx-rpc/rpc.tree | 1 + .../kotlinx-rpc/topics/grpc-client.topic | 8 +++-- .../kotlinx-rpc/topics/grpc-ktor-server.topic | 31 +++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 docs/pages/kotlinx-rpc/topics/grpc-ktor-server.topic diff --git a/docs/pages/kotlinx-rpc/rpc.tree b/docs/pages/kotlinx-rpc/rpc.tree index 7ae8df4a2..8f1c1fde5 100644 --- a/docs/pages/kotlinx-rpc/rpc.tree +++ b/docs/pages/kotlinx-rpc/rpc.tree @@ -35,6 +35,7 @@ + diff --git a/docs/pages/kotlinx-rpc/topics/grpc-client.topic b/docs/pages/kotlinx-rpc/topics/grpc-client.topic index 58cdc6676..becca5e4c 100644 --- a/docs/pages/kotlinx-rpc/topics/grpc-client.topic +++ b/docs/pages/kotlinx-rpc/topics/grpc-client.topic @@ -1,4 +1,8 @@ + +
  • usePlaintext() - is a JVM binding to Java gRPC runtime. Other bindings are also present.
  • -
    \ No newline at end of file + diff --git a/docs/pages/kotlinx-rpc/topics/grpc-ktor-server.topic b/docs/pages/kotlinx-rpc/topics/grpc-ktor-server.topic new file mode 100644 index 000000000..dc9bb0e2e --- /dev/null +++ b/docs/pages/kotlinx-rpc/topics/grpc-ktor-server.topic @@ -0,0 +1,31 @@ + + + + + + +

    + Similarly to , + you can use gRPC with Ktor: +

    + +fun Application.module() { + grpc(port = PORT, configure = { /* ... */ }) { + registerService<MyService> { MyServiceImpl() } + } +} + +

    + GrpcServer instance is created and bound to the Ktor Application lifetime. + It can be accessed via application.attributes[GrpcServerKey]. +

    + Add the Ktor dependency to your project: + + implementation("org.jetbrains.kotlinx:kotlinx-rpc-grpc-ktor-server:%kotlinx-rpc-version%") + +