https://kotlinlang.org logo
Join Slack
Powered by
# kotlinx-rpc
  • a

    Alexander Sysoev

    02/10/2025, 3:17 PM
    Hi! We've released experimental IDE support via plugin for our compiler plugin intellij idea It allows for in-IDE inspections and generated code autocompletion. Please try it out, and report any problems you may encounter! You can read a quick doc about it here.
    👍 3
    • 1
    • 1
  • a

    Alexander Sysoev

    02/13/2025, 1:05 PM
    🎉 We’ve released kotlinx-rpc
    0.5.1
    ! This release supports Kotlin 2.1.10
    kodee loving 4
  • r

    rocketraman

    02/14/2025, 9:36 PM
    I see from the docs that kRPC uses websockets, and it doesn't seem to have an http fallback. Is there any need for / has anyone considered an http fallback transport that uses SSE or long-polling for the
    KrpcTransport.receive
    ?
    a
    s
    • 3
    • 5
  • d

    daveford

    02/19/2025, 1:10 AM
    Does kotlin.rpc work on tomcat?
    a
    • 2
    • 1
  • t

    Tardisfan121

    02/19/2025, 2:53 PM
    Hi. I've got a project I'm trying to build using InteliJ IDE instead of Gradle but I get this kotlinc compile exception:
    Copy code
    Kotlin: [Internal Error] java.lang.NoClassDefFoundError: org/jetbrains/kotlin/com/intellij/psi/PsiElement
    	at kotlinx.rpc.codegen.checkers.diagnostics.FirRpcStrictModeDiagnostics.<init>(FirRpcDiagnostics.kt:48)
    	at kotlinx.rpc.codegen.FirCheckersContext.<init>(FirRpcAdditionalCheckers.kt:48)
    	at kotlinx.rpc.codegen.FirRpcAdditionalCheckers.<init>(FirRpcAdditionalCheckers.kt:31)
    	at kotlinx.rpc.codegen.FirRpcExtensionRegistrar.configurePlugin$lambda$1(FirRpcExtensionRegistrar.kt:32)
    	at org.jetbrains.kotlin.fir.extensions.FirExtensionService.registerExtensions(FirExtensionService.kt:43)
    	at org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrarKt.registerExtensions(FirExtensionRegistrar.kt:285)
    	at org.jetbrains.kotlin.fir.session.FirSessionConfigurator.configure(FirSessionConfigurator.kt:53)
    	at org.jetbrains.kotlin.fir.session.FirAbstractSessionFactory.createModuleBasedSession(FirAbstractSessionFactory.kt:124)
    	at ..... 58 more lines
    Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlin.com.intellij.psi.PsiElement
    	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
    	... 58 more
    Since the Gradle compilation works I'm going to split my rpc code into a separate module and use it as a library instead of from source. Any tips or is this a known issue? I can DM my project if needed (6mb zipped). I've tried combinations of kotlin 2.1.10 / 2.0.0 , rpc 0.5.0 + 0.4.0, and the FIR IDE Plugin 0.0.2 and (unreleased) 0.1.0 (built locally)
    a
    • 2
    • 2
  • l

    Laxystem

    02/19/2025, 6:23 PM
    Is there a way to create a 'dummy' service, without creating a ktor client + server?
    • 1
    • 1
  • h

    hellman

    03/07/2025, 12:24 PM
    Hi! If I have multiple services but on different paths, how do I configure the KtorRpcClient? Or do I need to create on for each path?
    a
    • 2
    • 1
  • j

    Joost Klitsie

    03/19/2025, 9:42 AM
    Hello dear people! I noticed that if we have an rpc client and we lose connection (aka I restart the server 🙂 ), the connection is closed and then the KtorRPCClient only throws "Connection reset" errors from that moment on. I can work around this, by creating a new ktorRpcClient whenever the old one's
    webSocketSession.isActive
    returns false, but is this the wanted behavior? I was kind of expecting to make 1 KtorRpcClient and reuse that instance, and not having to bother with recreating it. Or am I holding it wrong?
    👀 1
    a
    • 2
    • 3
  • r

    rocketraman

    03/29/2025, 3:38 PM
    Where is the source code for kotlinx-rpc-grpc? I want to use it as an example of implementing a new transport protocol. I'm considering implementing a new transport on top of #C01GU4B84G5 because gRPC does not support streaming and kRPC does not handle session failure.
    a
    • 2
    • 2
  • a

    Alexander Sysoev

    04/04/2025, 1:30 PM
    🎉 We’ve released kotlinx-rpc
    0.6.0
    ! • Non-suspending functions for server-sedi streaming in kRPC • Kotlin 2.1.20 • Other bug fixes Update now! 👇 https://github.com/Kotlin/kotlinx-rpc/releases/tag/0.6.0
    🎉 11
  • a

    Alexander Sysoev

    04/11/2025, 9:35 AM
    0.6.1
    bugfix release is out: https://github.com/Kotlin/kotlinx-rpc/releases/tag/0.6.1
    🎉 3
    K 4
  • d

    Dirk

    04/11/2025, 12:39 PM
    Hello, I have a problem with building a multiplatform library. As soon as I add the dependency "kotlinx.rpc.core" (the RPC plugin alone is not a problem), the project can no longer be integrated into my JS client because the build fails with an exception: java.lang.IllegalStateException: IrConstructorSymbolImpl is unbound. Signature: seskar.js/JsNative.<init>|<init>(){}[0]. The problem occurs with versions 0.6.0 and 0.6.1 and only requires the integration of the core library in Common. Did I make a mistake here? What could be the cause? Is it a problem with RPC or the Kotlin wrappers?
    a
    • 2
    • 2
  • d

    Dragos Rachieru

    04/11/2025, 5:35 PM
    The setup has only been tested on Kotlin/JVM projects.
    Does this mean that gRPC implementation works for multiplatform? For now, I just want the code to compile on KMP and generate the Protos, is this possible?
    a
    • 2
    • 3
  • a

    Alexander Sysoev

    04/18/2025, 8:30 AM
    0.6.2
    bugfix release is out: https://github.com/Kotlin/kotlinx-rpc/releases/tag/0.6.2
    👏 2
    K 2
  • a

    Alexander af Trolle

    04/19/2025, 2:22 PM
    Hi, was wondering would it be possible to setup something like json-patch for flows in a service? I've got a state object that will be sent frequently but only small portion will be updated on each emit. But I'd like too retain the nice dx of having a single state object instead of separating out into multiple flows and having to merge it on the client side. https://github.com/ReidSync/kotlin-json-patch
    a
    • 2
    • 1
  • s

    S.

    05/06/2025, 12:45 PM
    Service functions returning flows must not be suspending anymore? https://kotlin.github.io/kotlinx-rpc/features.html#send-and-receive-flows Why is this a requirement, it's rather disturbing when my flow comes from a suspend call like a db. and what's the best way to handle such cases?
    c
    a
    • 3
    • 11
  • y

    Yakiv Yereskovskyi

    05/08/2025, 1:17 PM
    Hey @Alexander Sysoev , you previously mentioned that fix for the issue 226 would be included in
    0.7.0
    release. Would you happen to have an approximate timeline for that release? Our team has been eagerly awaiting the fix for over six months now 😢
    a
    • 2
    • 8
  • a

    Alexander Sysoev

    05/14/2025, 11:34 AM
    0.7.0
    release is out: https://github.com/Kotlin/kotlinx-rpc/releases/tag/0.7.0 It's main purpose is to advance the deprecation cycle for old service APIs. Major changes to lifetimes and complete deprecation of old service APIs coming in
    0.8.0
    🎉 6
    👍 5
    👏 3
    👍🏾 1
  • d

    Dirk

    06/13/2025, 7:34 AM
    Hello, we already had to upgrade to version 2.2.0-RC2. Is there a way to also use KRPC with this Kotlin version? Is there a trick to set the version even if it's not officially supported, or is there by chance an EAP version available for it?
    a
    • 2
    • 5
  • a

    Alexander af Trolle

    06/29/2025, 9:14 PM
    Hi, with the simplfied lifetime changes in 0.8.0. Can there be a way to detect when a service is closed/canceled? Reason for asking is that I've added dependency injection for my services and I'm manually handling Create/Destroy of Scopes. I'm just trying to figure out what next step should be, thinking of moving scope to be connection based instead or remove them completely.
    a
    • 2
    • 2
  • a

    Alexander Sysoev

    07/02/2025, 12:45 AM
    🎉 We’ve released kotlinx-rpc
    0.8.0
    This release brings a lot of changes, including breaking changes: - Kotlin 2.2.0 Update - Decoupling of
    kotlinx.serialization
    from the core functionality - Simplifying lifetime schema (services lost their
    CoroutineScope
    ) - Irreversible enforcement of the strict mode These changes significantly reduce the number of footguns and improve the overall usability of the library. Additionally, the internal structure of kRPC protocol and our compiler plugin reduced its complexity. That allows us to provide better quality in future releases (and this also applies to gRPC, even though in this particular release it was not a priority). For the full list of changes that require migration, see the Migration Guide. We added three new documentation sections: - API Reference - Platform compatibility overview - Changelog in the web Full release notes: https://github.com/Kotlin/kotlinx-rpc/releases/tag/0.8.0
    👏 4
    🙌 3
    🎉 6
    kotlinx rpc 5
    y
    • 2
    • 3
  • d

    Dirk

    07/03/2025, 8:44 AM
    Hello, I would now like to finally integrate KRPC into our product to handle communication between the browser and microservices, replacing our custom solution. I have a question about authentication and service instance creation. My approach can be seen in the screenshot. The method jwtUndPortalrechtePruefenBlocking validates the JWT from the call and checks whether the user has the necessary permissions, then returns the user. Is the service now created for every call with the user, or does KRPC internally cache something and authentication needs to be handled differently? If that's the case, is there an example for this?
    a
    • 2
    • 10
  • d

    Dirk

    07/03/2025, 8:52 AM
    I would like to push events from the server that occur irregularly and sometimes with long pauses between them. I have found that the connection drops after 60 seconds. My WebSocket configuration is either incorrect or being ignored. How can I ensure that the connection stays open until the client terminates the connection?
    a
    • 2
    • 2
  • a

    Alexander af Trolle

    07/08/2025, 8:13 PM
    Hi, with the lifecycle changes I might have found a bug. Should each collection of a flow create a web-socket connection? I've created a minimal reproducer. https://github.com/afTrolle/kotlinx-rpc-websocket-connections/blob/main/kotlinx-rpc-websocket-connections/src/main/kotlin/Main.kt
    a
    a
    • 3
    • 8
  • a

    Alexander Sysoev

    07/09/2025, 1:29 PM
    0.8.1
    bugfix release is out: https://github.com/Kotlin/kotlinx-rpc/releases/tag/0.8.1 • Compiler fixes • Critical KrpcClient bug is fixed
    ❤️ 3
    kodee happy 5
    kotlinx rpc 2
    K 2
    d
    a
    +2
    • 5
    • 13
  • d

    Dirk

    07/11/2025, 8:07 AM
    Hello, I have a question about the service client: How should it be closed when I have a long-running query? Is it intended that I end the WebSocket session with cancel() or should I close the Ktor client with close()?
    a
    • 2
    • 4
  • d

    Dirk

    07/11/2025, 8:14 AM
    Hello, I have a problem with my existing Ktor project. Currently I'm using WebSockets and want to migrate these step by step to RPC. For this, I naturally have the WebSocket plugin installed in the project and configured according to my needs. When KRPC is now installed, Ktor no longer starts because the WebSocket plugin is installed twice. I have now removed the WebSocket plugin and made the settings at the route level (see Screenshot attached). However, serialization cannot be configured this way and therefore there's a runtime exception because Ktor can no longer serialize and deserialize the messages. I've temporarily helped myself with the Ktor function marked as internal sendSerializedBase: sendSerializedBase<FvWsResponse>(it as FvWsResponse, KotlinxWebsocketSerializationConverter(Json), Charsets.UTF_8) Have I overlooked something, how should I proceed in such situations?
    a
    a
    • 3
    • 4
  • y

    Yakiv Yereskovskyi

    07/11/2025, 12:49 PM
    Hey everyone. I’m migrating from
    0.4.0
    to
    0.8.1
    and it looks like new version doesn’t serialize default arguments anymore, I’m just getting NPE:
    Copy code
    Caused by: java.lang.NullPointerException: Parameter specified as non-null is null
    ...
    at kotlinx.serialization.json.internal.StreamingJsonEncoder.encodeSerializableValue(StreamingJsonEncoder.kt:259)
    	at kotlinx.serialization.encoding.AbstractEncoder.encodeSerializableElement(AbstractEncoder.kt:80)
    	at kotlinx.rpc.krpc.internal.CallableParametersSerializer.serialize(SerializationUtils.kt:127)
    	at kotlinx.rpc.krpc.internal.CallableParametersSerializer.serialize(SerializationUtils.kt:100)
    	at kotlinx.serialization.json.internal.StreamingJsonEncoder.encodeSerializableValue(StreamingJsonEncoder.kt:259)
    	at kotlinx.serialization.json.internal.JsonStreamsKt.encodeByWriter(JsonStreams.kt:99)
    Could you help to understand if this is regression or I did something wrong?
    ➕ 1
    a
    • 2
    • 14
  • v

    Vivek Modi

    07/14/2025, 8:41 PM
    Hey everyone, I'm currently looking for a Maven package, and I noticed that gRPC support might be available across multiple platforms like WebAssembly (WASM), Native, JVM, and others. Can anyone confirm this or share more details?
    a
    • 2
    • 5
  • a

    Alexander Sysoev

    07/18/2025, 10:09 AM
    0.9.1
    release is out: https://github.com/Kotlin/kotlinx-rpc/releases/tag/0.9.1 It's a bug fix release with a minor version bump because of a breaking change fix We fixed a problem in
    0.8.1
    with unresolved Apple and Windows artifacts. The same problem affected initial
    0.9.0
    release, that's why we've published
    0.9.1
    and skipped
    0.9.0
    .
    🚀 7