Skip to content

Commit f4372a0

Browse files
committed
Docs for gRPC with Ktor #393
1 parent 0db8fb0 commit f4372a0

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

docs/pages/kotlinx-rpc/rpc.tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<toc-element topic="grpc-services.topic"/>
3636
<toc-element topic="grpc-client.topic"/>
3737
<toc-element topic="grpc-server.topic"/>
38+
<toc-element topic="grpc-ktor-server.topic"/>
3839
</toc-element>
3940
</toc-element>
4041
<toc-element topic="strict-mode.topic"/>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
- Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
4+
-->
5+
6+
<!DOCTYPE topic
7+
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
8+
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
10+
title="Ktor Server" id="grpc-ktor-server">
11+
12+
<p>
13+
Similarly to <a href="grpc-server.topic"/>,
14+
you can use gRPC with Ktor:
15+
</p>
16+
<code-block lang="kotlin">
17+
fun Application.module() {
18+
grpc(port = PORT, configure = { /* ... */ }) {
19+
registerService&lt;MyService&gt; { MyServiceImpl() }
20+
}
21+
}
22+
</code-block>
23+
<p>
24+
<code>GrpcServer</code> instance is created and bound to the Ktor Application lifetime.
25+
It can be accessed via <code>application.attributes[GrpcServerKey]</code>.
26+
</p>
27+
Add the Ktor dependency to your project:
28+
<code-block lang="kotlin">
29+
implementation("org.jetbrains.kotlinx:kotlinx-rpc-grpc-ktor-server:%kotlinx-rpc-version%")
30+
</code-block>
31+
</topic>

0 commit comments

Comments
 (0)