Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2458,12 +2458,7 @@ wrappy@1:
resolved "https://packages.jetbrains.team/npm/p/krpc/build-deps/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==

[email protected]:
version "8.5.0"
resolved "https://packages.jetbrains.team/npm/p/krpc/build-deps/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f"
integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==

ws@^8.18.0:
[email protected], ws@^8.18.0:
version "8.18.0"
resolved "https://packages.jetbrains.team/npm/p/krpc/build-deps/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc"
integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==
Expand Down
3 changes: 3 additions & 0 deletions samples/ktor-all-platforms-app/.fleet/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"gradle.autoImportOnSave": false
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import androidx.compose.animation.AnimatedVisibility
Expand All @@ -14,7 +14,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import io.ktor.client.*
import io.ktor.http.*
import kotlinx.rpc.krpc.ktor.client.installRPC
import kotlinx.rpc.krpc.ktor.client.installKrpc
import kotlinx.rpc.krpc.ktor.client.rpc
import kotlinx.rpc.krpc.ktor.client.rpcConfig
import kotlinx.rpc.krpc.serialization.json.json
Expand All @@ -28,7 +28,7 @@ expect val DEV_SERVER_HOST: String

val client by lazy {
HttpClient {
installRPC()
installKrpc()
}
}

Expand Down
18 changes: 9 additions & 9 deletions samples/ktor-all-platforms-app/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
kotlin = "2.0.21"
kotlin = "2.1.0"

agp = "8.7.2"
agp = "8.8.0-alpha05"
android-compileSdk = "35"
android-minSdk = "24"
android-targetSdk = "35"
Expand All @@ -12,14 +12,14 @@ androidx-core-ktx = "1.15.0"
androidx-espresso-core = "3.6.1"
androidx-material = "1.12.0"
androidx-test-junit = "1.2.1"
compose = "1.7.5"
compose-plugin = "1.7.0"
compose = "1.7.6"
compose-plugin = "1.8.0-alpha01"
junit = "4.13.2"
ktor = "3.0.1"
logback = "1.5.12"
serialization = "1.7.3"
coroutines = "1.9.0"
kotlinx-rpc = "0.4.0"
ktor = "3.0.3"
logback = "1.5.16"
serialization = "1.8.0"
coroutines = "1.10.1"
kotlinx-rpc = "0.5.0"

[libraries]
# kotlin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions samples/ktor-all-platforms-app/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.rpc.sample
Expand All @@ -10,15 +10,15 @@ import io.ktor.server.application.*
import io.ktor.server.netty.*
import io.ktor.server.plugins.cors.routing.*
import io.ktor.server.routing.*
import kotlinx.rpc.krpc.ktor.server.RPC
import kotlinx.rpc.krpc.ktor.server.Krpc
import kotlinx.rpc.krpc.ktor.server.rpc
import kotlinx.rpc.krpc.serialization.json.json

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

@Suppress("unused")
fun Application.module() {
install(RPC)
install(Krpc)

installCORS()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.rpc.sample
Expand All @@ -8,7 +8,7 @@ import UserData
import UserService
import io.ktor.server.testing.*
import kotlinx.coroutines.flow.toList
import kotlinx.rpc.krpc.ktor.client.installRPC
import kotlinx.rpc.krpc.ktor.client.installKrpc
import kotlinx.rpc.krpc.ktor.client.rpc
import kotlinx.rpc.krpc.ktor.client.rpcConfig
import kotlinx.rpc.krpc.serialization.json.json
Expand All @@ -21,7 +21,7 @@ class ApplicationTest {
@Test
fun testRoot() = testApplication {
val service = createClient {
installRPC()
installKrpc()
}.rpc("/api") {
rpcConfig {
serialization {
Expand Down
2 changes: 1 addition & 1 deletion samples/ktor-all-platforms-app/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

@file:Suppress("UnstableApiUsage")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.rpc.sample.data

import io.ktor.client.HttpClient
import io.ktor.client.engine.okhttp.OkHttp
import io.ktor.client.request.url
import kotlinx.rpc.RPCClient
import kotlinx.rpc.krpc.ktor.client.installRPC
import kotlinx.rpc.RpcClient
import kotlinx.rpc.krpc.ktor.client.installKrpc
import kotlinx.rpc.krpc.ktor.client.rpc
import kotlinx.rpc.krpc.ktor.client.rpcConfig
import kotlinx.rpc.krpc.serialization.json.json

suspend fun createRpcClient(): RPCClient {
suspend fun createRpcClient(): RpcClient {
return HttpClient(OkHttp) {
installRPC()
installKrpc()
}.rpc {
url("ws://10.0.2.2:8080/api")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.rpc.sample.ui
Expand All @@ -14,14 +14,14 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch
import kotlinx.rpc.RPCClient
import kotlinx.rpc.RpcClient
import kotlinx.rpc.krpc.streamScoped
import kotlinx.rpc.withService
import kotlinx.rpc.sample.MyService
import kotlinx.rpc.sample.UserData

class AppViewModel : ViewModel() {
private var rpcClient: RPCClient? = null
private var rpcClient: RpcClient? = null
private var apiService: MyService? = null

private val _uiState = MutableStateFlow<WelcomeData?>(null)
Expand Down Expand Up @@ -64,4 +64,4 @@ class AppViewModel : ViewModel() {
}
}
}
}
}
18 changes: 9 additions & 9 deletions samples/ktor-android-app/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[versions]
agp = "8.7.2"
kotlin = "2.0.21"
agp = "8.8.0"
kotlin = "2.1.0"
androidx-activityCompose = "1.9.3"
androidx-appcompat = "1.7.0"
androidx-constraintlayout = "2.2.0"
androidx-core-ktx = "1.15.0"
androidx-test-junit = "1.2.1"
compose = "1.7.5"
compose = "1.7.6"
compose-plugin = "1.5.14" # https://mvnrepository.com/artifact/androidx.compose.compiler/compiler
compose-bom = "2024.10.01"
compose-bom = "2024.12.01"
material3 = "1.3.1"
junit = "4.13.2"
ktor = "3.0.1"
kotlinx-serialization-json = "1.7.3"
kotlinx-coroutines-core = "1.9.0"
logback = "1.5.12"
kotlinx-rpc = "0.4.0"
ktor = "3.0.3"
kotlinx-serialization-json = "1.8.0"
kotlinx-coroutines-core = "1.10.1"
logback = "1.5.16"
kotlinx-rpc = "0.5.0"

[libraries]
# kotlin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions samples/ktor-android-app/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package kotlinx.rpc.sample

import io.ktor.server.application.*
import io.ktor.server.cio.*
import io.ktor.server.routing.*
import io.ktor.server.websocket.*
import kotlinx.rpc.krpc.ktor.server.Krpc
import kotlinx.rpc.krpc.ktor.server.rpc
import kotlinx.rpc.krpc.serialization.json.json

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

@Suppress("unused")
fun Application.module() {
install(WebSockets)
install(Krpc)

routing {
rpc("/api") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import io.ktor.client.request.*
Expand All @@ -9,7 +9,7 @@ import io.ktor.server.response.*
import io.ktor.server.routing.*
import io.ktor.server.testing.*
import kotlinx.coroutines.flow.toList
import kotlinx.rpc.krpc.ktor.client.installRPC
import kotlinx.rpc.krpc.ktor.client.installKrpc
import kotlinx.rpc.krpc.ktor.client.rpc
import kotlinx.rpc.krpc.ktor.client.rpcConfig
import kotlinx.rpc.krpc.serialization.json.json
Expand All @@ -24,7 +24,7 @@ class ApplicationTest {
@Test
fun testRoot() = testApplication {
val service = createClient {
installRPC()
installKrpc()
}.rpc("/api") {
rpcConfig {
serialization {
Expand Down
3 changes: 0 additions & 3 deletions samples/ktor-web-app/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Ktor Web App
Sample application with Kotlin/Js on frontend and Kotlin/Jvm on backend,that uses kRPC with Ktor to communicate.

> Warning: the code is broken due to https://youtrack.jetbrains.com/issue/KT-71757/
> No workarounds for now

### Running frontend
To run frontend in development mode, run this command:
```bash
Expand Down
1 change: 1 addition & 0 deletions samples/ktor-web-app/frontend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ kotlin {
implementation(libs.kotlin.stdlib.js)
implementation(libs.ktor.client.js)
implementation(libs.ktor.client.websockets.js)
implementation(libs.kotlinx.rpc.core)
implementation(libs.kotlinx.rpc.krpc.ktor.client)
implementation(libs.kotlinx.rpc.krpc.serialization.json)

Expand Down
4 changes: 2 additions & 2 deletions samples/ktor-web-app/frontend/src/jsMain/kotlin/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import kotlinx.rpc.RPCClient
import kotlinx.rpc.RpcClient
import kotlinx.rpc.withService
import react.FC
import react.Props
Expand All @@ -11,7 +11,7 @@ import react.useEffectOnce
import react.useState

val App = FC<Props> {
var rpcClient by useState<RPCClient?>(null)
var rpcClient by useState<RpcClient?>(null)

useEffectOnce {
rpcClient = initRpcClient()
Expand Down
8 changes: 4 additions & 4 deletions samples/ktor-web-app/frontend/src/jsMain/kotlin/RPC.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import io.ktor.client.*
import io.ktor.client.engine.js.*
import io.ktor.client.request.*
import kotlinx.rpc.RPCClient
import kotlinx.rpc.krpc.ktor.client.installRPC
import kotlinx.rpc.RpcClient
import kotlinx.rpc.krpc.ktor.client.installKrpc
import kotlinx.rpc.krpc.ktor.client.rpc
import kotlinx.rpc.krpc.ktor.client.rpcConfig
import kotlinx.rpc.krpc.serialization.json.json

suspend fun initRpcClient(): RPCClient {
suspend fun initRpcClient(): RpcClient {
return HttpClient(Js) {
installRPC()
installKrpc()
}.rpc {
url("ws://localhost:8080/api")

Expand Down
14 changes: 7 additions & 7 deletions samples/ktor-web-app/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[versions]
kotlin = "2.0.21"
kotlin-wrappers-bom = "1.0.0-pre.823"
ktor = "3.0.1"
kotlinx-serialization-json = "1.7.3"
kotlinx-coroutines-core = "1.9.0"
logback = "1.5.12"
kotlinx-rpc = "0.4.0"
kotlin = "2.1.0"
kotlin-wrappers-bom = "2025.1.2"
ktor = "3.0.3"
kotlinx-serialization-json = "1.8.0"
kotlinx-coroutines-core = "1.10.1"
logback = "1.5.16"
kotlinx-rpc = "0.5.0"

[libraries]
# kotlin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions samples/ktor-web-app/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
Loading