File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 35
35
<toc-element topic =" grpc-services.topic" />
36
36
<toc-element topic =" grpc-client.topic" />
37
37
<toc-element topic =" grpc-server.topic" />
38
+ <toc-element topic =" grpc-ktor-server.topic" />
38
39
</toc-element >
39
40
</toc-element >
40
41
<toc-element topic =" strict-mode.topic" />
Original file line number Diff line number Diff line change 1
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
+
2
6
<!DOCTYPE topic
3
7
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
4
8
<topic xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
21
25
val result = recognizer.recognize(image)
22
26
println("Recognized category: ${result.category}")
23
27
24
- grpcClient.cancel ()
28
+ grpcClient.close ()
25
29
</code-block >
26
30
<list >
27
31
<li >
28
32
<code >usePlaintext()</code > - is a JVM binding to Java gRPC runtime. Other bindings are also present.
29
33
</li >
30
34
</list >
31
- </topic >
35
+ </topic >
Original file line number Diff line number Diff line change
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< MyService> { 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 >
You can’t perform that action at this time.
0 commit comments