@@ -19,22 +19,16 @@ Build your RPC with already known language constructs and nothing more!
19
19
20
20
First, create your RPC service and define some methods:
21
21
``` kotlin
22
- import kotlinx.rpc.RemoteService
23
- import kotlinx.rpc.annotations.Rpc
24
-
25
22
@Rpc
26
- interface AwesomeService : RemoteService {
23
+ interface AwesomeService {
27
24
fun getNews (city : String ): Flow <String >
28
25
29
26
suspend fun daysUntilStableRelease (): Int
30
27
}
31
28
```
32
29
In your server code define how to respond by simply implementing the service:
33
30
``` kotlin
34
- class AwesomeServiceImpl (
35
- val parameters : AwesomeParameters ,
36
- override val coroutineContext : CoroutineContext ,
37
- ) : AwesomeService {
31
+ class AwesomeServiceImpl (val parameters : AwesomeParameters ) : AwesomeService {
38
32
override fun getNews (city : String ): Flow <String > {
39
33
return flow {
40
34
emit(" Today is 23 degrees!" )
@@ -66,8 +60,8 @@ fun main() {
66
60
}
67
61
}
68
62
69
- registerService<AwesomeService > { ctx ->
70
- AwesomeServiceImpl (AwesomeParameters (false , null ), ctx )
63
+ registerService<AwesomeService > {
64
+ AwesomeServiceImpl (AwesomeParameters (false , null ))
71
65
}
72
66
}
73
67
}
@@ -90,10 +84,8 @@ val service = rpcClient.withService<AwesomeService>()
90
84
91
85
service.daysUntilStableRelease()
92
86
93
- streamScoped {
94
- service.getNews(" KotlinBurg" ).collect { article ->
95
- println (article)
96
- }
87
+ service.getNews(" KotlinBurg" ).collect { article ->
88
+ println (article)
97
89
}
98
90
```
99
91
@@ -106,6 +98,33 @@ Check out our [getting started guide](https://kotlin.github.io/kotlinx-rpc) for
106
98
To ensure that all IDE features of our compiler plugin work properly on IntelliJ-based IDEs, install the
107
99
[ Kotlin External FIR Support] ( https://plugins.jetbrains.com/plugin/26480-kotlin-external-fir-support?noRedirect=true ) plugin.
108
100
101
+ ## Kotlin compatibility
102
+ We support all stable Kotlin versions starting from 2.0.0:
103
+ - 2.0.0, 2.0.10, 2.0.20, 2.0.21
104
+ - 2.1.0, 2.1.10, 2.1.20, 2.1.21
105
+
106
+ For a full compatibility checklist,
107
+ see [ Versions] ( https://kotlin.github.io/kotlinx-rpc/versions.html ) .
108
+
109
+ ## Supported Platforms
110
+
111
+ ` kotlinx.rpc ` is a KMP library, so we aim to support all available platforms.
112
+
113
+ However, we are also a multi-module library, meaning that some modules may not support some platforms.
114
+
115
+ Current high-level status:
116
+
117
+ | Subsystem | Supported Platforms |
118
+ | -----------| --------------------------------------------|
119
+ | Core | JVM, Native, JS, WasmJs, WasmWASI, Windows |
120
+ | kRPC | JVM, Native, JS, WasmJs, Windows |
121
+ | gRPC | JVM (in JVM-only projects) |
122
+
123
+ For more detailed module by module information,
124
+ check out our [ platform support table] ( https://kotlin.github.io/kotlinx-rpc/platforms.html ) .
125
+
126
+ For information about gRPC, see [ gRPC Integration] ( #grpc-integration )
127
+
109
128
### Gradle plugins
110
129
111
130
` kotlinx.rpc ` provides Gradle plugin ` org.jetbrains.kotlinx.rpc.plugin `
@@ -174,14 +193,6 @@ For more information on gRPC usage,
174
193
see the [ official documentation] ( https://kotlin.github.io/kotlinx-rpc/grpc-configuration.html ) .
175
194
For a working example, see the [ sample gRPC project] ( /samples/grpc-app ) .
176
195
177
- ## Kotlin compatibility
178
- We support all stable Kotlin versions starting from 2.0.0:
179
- - 2.0.0, 2.0.10, 2.0.20, 2.0.21
180
- - 2.1.0, 2.1.10, 2.1.20, 2.1.21
181
-
182
- For a full compatibility checklist,
183
- see [ Versions] ( https://kotlin.github.io/kotlinx-rpc/versions.html ) .
184
-
185
196
## JetBrains Product
186
197
187
198
` kotlinx.rpc ` is an official [ JetBrains] ( https://jetbrains.com ) product and is primarily developed by the team at JetBrains, with
0 commit comments