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 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" />
Original file line number Diff line number Diff line change 11<?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+
26<!DOCTYPE topic
37 SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
48<topic xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
2125 val result = recognizer.recognize(image)
2226 println("Recognized category: ${result.category}")
2327
24- grpcClient.cancel ()
28+ grpcClient.close ()
2529 </code-block >
2630 <list >
2731 <li >
2832 <code >usePlaintext()</code > - is a JVM binding to Java gRPC runtime. Other bindings are also present.
2933 </li >
3034 </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