When im receiving Frame.Text I get `Exception in t...
# ktor
j
When im receiving Frame.Text I get
Exception in thread "DefaultDispatcher-worker-3" kotlinx.io.charsets.MalformedInputException: Input length = 1
e
Hi, @jkbbwr. Do you use
https
?
j
Copy code
@KtorExperimentalAPI
fun client(token: String): HttpClient {
    return HttpClient(CIO) {
        install(WebSockets)

        install(JsonFeature) {
            serializer = KotlinxSerializer(JSON.nonstrict)
        }

        install(Logging) {
            logger = Logger.SIMPLE
            level = LogLevel.ALL
        }

        defaultRequest {
            header("Authorization", "Bearer $token")
        }
    }
}


@KtorExperimentalAPI
suspend fun main(args: Array<String>) {
    val client = client(FRIDAY_BOT_ACCESS_TOKEN)
    val rtm = client.get<RTM>("<https://slack.com/api/rtm.connect>")
    client.wss(host = rtm.host, path = rtm.path) {

        //pingInterval = Duration.ofSeconds(5)

        while (true) {
            val frame = withTimeoutOrNull(Duration.ofSeconds(5)) {
                incoming.receive()
            }
            when(frame) {
                null -> {
                    send(JSON.stringify(Ping.serializer(), Ping()))
                }
                is Frame.Text -> {
                    println(frame.readText())
                }
            }
        }
    }
}
No matter what I do, it malforms and incoming gets closed.
e
It looks like the known issue with CIO
https
j
Oof. Any idea on the timeline for a fix?
And is it tracked in jetbrains.youtrack or on github
Any idea about the above? Its kinda showstopping for that project if it can't maintain the connection 🙂
e
The fix would be available in the next minor update. Sorry for the delay
j
Do you know the schedule for that release