https://kotlinlang.org logo
Join Slack
Powered by
# kotlinx-rpc
  • 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
    .
    🚀 8
  • d

    Dumitru Preguza

    08/03/2025, 6:31 PM
    I have this error on iOS client and I'm not sure how to fix it:
    Copy code
    Error Domain=NSURLErrorDomain Code=-1011 "There was a bad response from the server." UserInfo={NSErrorFailingURLStringKey=<ws://test.com/rpc>, NSErrorFailingURLKey=<ws://test.com/rpc>, _NSURLLErrorWebSocketHandshakeFailureReasonKey=0, NSLocalizedDescription=There was a bad response from the server.}
    a
    • 2
    • 11
  • d

    Dirk

    08/04/2025, 11:02 AM
    Hello, I have a question about the Service Client. I create and open it and can then communicate with the server. However, as soon as there's more than 60 seconds between two requests, the exception "Channel was cancelled" is thrown. I would have expected that when the connection is closed after 60 seconds and another request is made, the connection would be re-established. Is this a false assumption? Should a new client be created for each query (to avoid having to track the elapsed time between queries)? Or is it intended that when multiple queries occur with pauses in between, the timeout on the server must be set to infinite? (Client used with Kotlin/JS)
    a
    • 2
    • 3
  • d

    Dirk

    08/04/2025, 4:16 PM
    I have already implemented and set up a WebSocket connection in my existing and older Ktor microservice. In the current KRPC release, the WebSocket plugin and KRPC can now be installed additionally. However, the WebSocket settings (timeouts) seem to also be used for KRPC. Is this the intended behavior, or does Ktor only allow one configuration?
    a
    • 2
    • 2
  • d

    Dumitru Preguza

    08/11/2025, 10:59 AM
    There should be created a sample for a Chat like app made on kRPC. I want to be sure that the pattern would be something like this:
    Copy code
    Interface ChatService {
       sendMessage(Message): Unit
       receivedMessages(): Flow<Message> //infinite pulling of messages?
    }
    a
    j
    • 3
    • 40
  • a

    Alexander Sysoev

    08/13/2025, 2:00 PM
    Hey! While regular updates are on pause because we are actively working on gRPC, the podcast that I did with @Sebastian Aigner in February is out 🐕 We talked basics, motivations, gRPC, kRPC, compiler plugins and everything in between kotlinx rpc YouTube (with my small comment):

    https://youtu.be/mB6cJAXxFGk▾

    Itunes: https://podcasts.apple.com/us/podcast/kotlinx-rpc/id1194631266 Spotify: https://open.spotify.com/episode/3zfbfi5Gz1vKlYmVNJylls
    ❤️ 4
    kotlinx rpc 5
    d
    • 2
    • 2
  • a

    andylamax

    08/17/2025, 10:29 PM
    are there plans to add authentication support backed into krpc?
    👀 4
    d
    d
    n
    • 4
    • 28
  • j

    joseph_ivie

    08/19/2025, 2:34 PM
    Is there any documentation about how KotlinX RPC / Ktor / kRPC actually communicates? I don't feel I can safely adopt KRPC unless I know I can connect an application in a different language to it and understand what I'm looking for in networking logs.
    a
    j
    • 3
    • 3
  • j

    Javier

    08/19/2025, 4:22 PM
    Will the gRPC implementation work with compose in a straightforward way? I have seen that connecting gRPC with web frameworks like React, due to the nature of how web works, is not as easy as doing it on Android, iOS or Desktop. Being able to create a web with Compose and consuming gRPC in an easy way would be really nice.
    a
    • 2
    • 1
  • g

    galex

    08/20/2025, 7:20 PM
    Hello, I'm very interested in WASM capable bidirectional streaming. Is this in the plans for kotlin-rpc? I especially looking for this on gRTC ☺️
    a
    • 2
    • 8
  • n

    neworldlt

    08/20/2025, 7:34 PM
    Is there any clever way to set protocol (AKA
    Sec-WebSocket-Protocol
    ) on krpc server side? The default option does not leave opportunity to do that: https://github.com/Kotlin/kotlinx-rpc/blob/main/krpc/krpc-ktor/krpc-ktor-server/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/server/KtorServerDsl.kt#L45
    a
    • 2
    • 5
  • d

    Dumitru Preguza

    08/23/2025, 3:49 PM
    I encountered this issue after updating the Kotlin version in my project to 2.2.10:
    Could not find org.jetbrains.kotlinx:kotlinx-rpc-compiler-plugin-k2:2.2.10-0.9.1
    It feels counterintuitive that updating the language version would affect the libraries. Shouldn’t it be backward compatible?
    a
    n
    • 3
    • 5
  • d

    Dumitru Preguza

    08/26/2025, 10:19 PM
    I have another question, so far I know that users have 2-3 primary use cases for this library: 1) client to server communication a) the client is a browser b) the client is an android or iOS app 2) server to server communication Also from this chat I found that there are some known limitations of this lib: 1) the connection can get lost after a long inaction - can it happen for all listed above scenarios? 2) If I build a micro-services based design for my app on top of kRPC (server to server), what are other things I should be aware of?
    d
    • 2
    • 1
  • d

    Dirk

    09/01/2025, 12:42 PM
    Hello, Will there be a release to support the current Kotlin version 2.2.10? Is there already an estimated release date?
    a
    • 2
    • 2
  • l

    Luke W

    09/01/2025, 8:08 PM
    Kotlin-logging has added wasm/wasi support, so I think it shouldn't be too hard to add support to krpc?
    a
    • 2
    • 1
  • s

    Slackbot

    09/02/2025, 1:00 AM
    This message was deleted.
    a
    • 2
    • 1
  • a

    andylamax

    09/10/2025, 1:32 PM
    Hi there What is the best practice when dealing with a KtorRpcClient? • Create 1 and use it in the entirety of the application • Create a client when you need to create a certain number of operations then close it Followup question. • In the occasion that the server/client has disconnected. What is the best way to dynamically reestablish the connection on the same KtorRpcClient?
    a
    • 2
    • 5
  • n

    neworldlt

    09/10/2025, 9:35 PM
    Unfortunatelly, the hack for running the RPC compiler in 2.2.10 does not work with the 2.2.20 version 😞
    a
    • 2
    • 3
  • r

    Robert

    09/14/2025, 8:46 AM
    Hey all. Interestingly looking into kotlinx-rpc. I'm especially interested in the gRPC part. From the Github issue from @Mr3Zee I understand that's part of it is available in the dev branch (grpc-release?). I was wondering why there's JVM support but no Android-support yet - any specific blockers? I would love to use it multiplatform.
    a
    a
    • 3
    • 3
  • r

    Rafael Diaz

    09/20/2025, 3:47 PM
    Hi! I’m considering using KRPC for a project, but I do have a few questions. 1) Are there any examples of using KRPC without Ktor, ideally via HTTP transport instead of web socket? I guess the question below is not as important, since I can test it out myself once I do the above. But just in case: 2) My backend is JVM Kotlin, with a Compose Multiplatform frontend. Since KRPC has us declare a shared interface along with a client and server implemention, would I able to use KRPC despite the backend being JVM and the frontend KMP? As a follow up, I was thinking of using virtual threads-based system for the backend, and coroutines-based for the CMP frontend. Would this be doable?
    a
    n
    • 3
    • 3