Skip to content

Commit b213f05

Browse files
committed
Update samples
1 parent d5ce101 commit b213f05

File tree

23 files changed

+86
-75
lines changed

23 files changed

+86
-75
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"gradle.autoImportOnSave": false
3+
}

samples/ktor-all-platforms-app/composeApp/src/commonMain/kotlin/App.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
import androidx.compose.animation.AnimatedVisibility
@@ -14,7 +14,7 @@ import androidx.compose.ui.Alignment
1414
import androidx.compose.ui.Modifier
1515
import io.ktor.client.*
1616
import io.ktor.http.*
17-
import kotlinx.rpc.krpc.ktor.client.installRPC
17+
import kotlinx.rpc.krpc.ktor.client.installKrpc
1818
import kotlinx.rpc.krpc.ktor.client.rpc
1919
import kotlinx.rpc.krpc.ktor.client.rpcConfig
2020
import kotlinx.rpc.krpc.serialization.json.json
@@ -28,7 +28,7 @@ expect val DEV_SERVER_HOST: String
2828

2929
val client by lazy {
3030
HttpClient {
31-
installRPC()
31+
installKrpc()
3232
}
3333
}
3434

samples/ktor-all-platforms-app/gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[versions]
2-
kotlin = "2.0.21"
2+
kotlin = "2.1.0"
33

4-
agp = "8.8.0"
4+
agp = "8.8.0-alpha05"
55
android-compileSdk = "35"
66
android-minSdk = "24"
77
android-targetSdk = "35"
@@ -13,13 +13,13 @@ androidx-espresso-core = "3.6.1"
1313
androidx-material = "1.12.0"
1414
androidx-test-junit = "1.2.1"
1515
compose = "1.7.6"
16-
compose-plugin = "1.8.0+check"
16+
compose-plugin = "1.8.0-alpha01"
1717
junit = "4.13.2"
1818
ktor = "3.0.3"
1919
logback = "1.5.16"
2020
serialization = "1.8.0"
2121
coroutines = "1.10.1"
22-
kotlinx-rpc = "0.4.0"
22+
kotlinx-rpc = "0.5.0"
2323

2424
[libraries]
2525
# kotlin

samples/ktor-all-platforms-app/server/src/main/kotlin/kotlinx/rpc/sample/Application.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.rpc.sample
@@ -10,15 +10,15 @@ import io.ktor.server.application.*
1010
import io.ktor.server.netty.*
1111
import io.ktor.server.plugins.cors.routing.*
1212
import io.ktor.server.routing.*
13-
import kotlinx.rpc.krpc.ktor.server.RPC
13+
import kotlinx.rpc.krpc.ktor.server.Krpc
1414
import kotlinx.rpc.krpc.ktor.server.rpc
1515
import kotlinx.rpc.krpc.serialization.json.json
1616

1717
fun main(args: Array<String>): Unit = EngineMain.main(args)
1818

1919
@Suppress("unused")
2020
fun Application.module() {
21-
install(RPC)
21+
install(Krpc)
2222

2323
installCORS()
2424

samples/ktor-all-platforms-app/server/src/test/kotlin/kotlinx/rpc/sample/ApplicationTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.rpc.sample
@@ -8,7 +8,7 @@ import UserData
88
import UserService
99
import io.ktor.server.testing.*
1010
import kotlinx.coroutines.flow.toList
11-
import kotlinx.rpc.krpc.ktor.client.installRPC
11+
import kotlinx.rpc.krpc.ktor.client.installKrpc
1212
import kotlinx.rpc.krpc.ktor.client.rpc
1313
import kotlinx.rpc.krpc.ktor.client.rpcConfig
1414
import kotlinx.rpc.krpc.serialization.json.json
@@ -21,7 +21,7 @@ class ApplicationTest {
2121
@Test
2222
fun testRoot() = testApplication {
2323
val service = createClient {
24-
installRPC()
24+
installKrpc()
2525
}.rpc("/api") {
2626
rpcConfig {
2727
serialization {

samples/ktor-all-platforms-app/settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
@file:Suppress("UnstableApiUsage")

samples/ktor-android-app/app/src/main/kotlin/kotlinx/rpc/sample/data/Client.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.rpc.sample.data
66

77
import io.ktor.client.HttpClient
88
import io.ktor.client.engine.okhttp.OkHttp
99
import io.ktor.client.request.url
10-
import kotlinx.rpc.RPCClient
11-
import kotlinx.rpc.krpc.ktor.client.installRPC
10+
import kotlinx.rpc.RpcClient
11+
import kotlinx.rpc.krpc.ktor.client.installKrpc
1212
import kotlinx.rpc.krpc.ktor.client.rpc
1313
import kotlinx.rpc.krpc.ktor.client.rpcConfig
1414
import kotlinx.rpc.krpc.serialization.json.json
1515

16-
suspend fun createRpcClient(): RPCClient {
16+
suspend fun createRpcClient(): RpcClient {
1717
return HttpClient(OkHttp) {
18-
installRPC()
18+
installKrpc()
1919
}.rpc {
2020
url("ws://10.0.2.2:8080/api")
2121

samples/ktor-android-app/app/src/main/kotlin/kotlinx/rpc/sample/ui/AppViewModel.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.rpc.sample.ui
@@ -14,14 +14,14 @@ import kotlinx.coroutines.delay
1414
import kotlinx.coroutines.flow.MutableStateFlow
1515
import kotlinx.coroutines.flow.StateFlow
1616
import kotlinx.coroutines.launch
17-
import kotlinx.rpc.RPCClient
17+
import kotlinx.rpc.RpcClient
1818
import kotlinx.rpc.krpc.streamScoped
1919
import kotlinx.rpc.withService
2020
import kotlinx.rpc.sample.MyService
2121
import kotlinx.rpc.sample.UserData
2222

2323
class AppViewModel : ViewModel() {
24-
private var rpcClient: RPCClient? = null
24+
private var rpcClient: RpcClient? = null
2525
private var apiService: MyService? = null
2626

2727
private val _uiState = MutableStateFlow<WelcomeData?>(null)
@@ -64,4 +64,4 @@ class AppViewModel : ViewModel() {
6464
}
6565
}
6666
}
67-
}
67+
}

samples/ktor-android-app/gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22
agp = "8.8.0"
3-
kotlin = "2.0.21"
3+
kotlin = "2.1.0"
44
androidx-activityCompose = "1.9.3"
55
androidx-appcompat = "1.7.0"
66
androidx-constraintlayout = "2.2.0"
@@ -15,7 +15,7 @@ ktor = "3.0.3"
1515
kotlinx-serialization-json = "1.8.0"
1616
kotlinx-coroutines-core = "1.10.1"
1717
logback = "1.5.16"
18-
kotlinx-rpc = "0.4.0"
18+
kotlinx-rpc = "0.5.0"
1919

2020
[libraries]
2121
# kotlin

samples/ktor-android-app/server/src/main/kotlin/kotlinx/rpc/sample/Application.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44
package kotlinx.rpc.sample
55

66
import io.ktor.server.application.*
77
import io.ktor.server.cio.*
88
import io.ktor.server.routing.*
9-
import io.ktor.server.websocket.*
9+
import kotlinx.rpc.krpc.ktor.server.Krpc
1010
import kotlinx.rpc.krpc.ktor.server.rpc
1111
import kotlinx.rpc.krpc.serialization.json.json
1212

1313
fun main(args: Array<String>): Unit = EngineMain.main(args)
1414

1515
@Suppress("unused")
1616
fun Application.module() {
17-
install(WebSockets)
17+
install(Krpc)
1818

1919
routing {
2020
rpc("/api") {

0 commit comments

Comments
 (0)