Hello, I have a problem with my existing Ktor proj...
# kotlinx-rpc
d
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
Hey, make sure you are using version, 0.8.1 Not sure what you are trying to do, Are you trying to reuse a existing web-socket connection that you already setup? If not I highly recommend checking out the samples in the project. https://github.com/Kotlin/kotlinx-rpc/blob/main/samples/simple-ktor-app/src/main/kotlin/Server.kt
d
I have already implemented an application in Ktor that uses long-running WebSockets for communication with the client. Now, for a new requirement (and possibly to migrate the old functions in the future), I want to switch to KRPC. However, after adding the KRPC plugin, Ktor no longer starts because the WebSocket plugin is internally added again with different settings (so i removed my install block of the ws-plugin). I can configure the timing settings at the route level, but I have not found a way to configure serialization—which is usually done in the install block of the WebSocket plugin—at the route level as well. So my question is: Is there a solution for this without using the low-level methods marked as internal by Ktor and thus receiving corresponding warnings in IntelliJ?
a
Hmm, I'll take a look and will get back to you next week
👍 1