I'm using ktor-client (CIO) for communicating over...
# ktor
p
I'm using ktor-client (CIO) for communicating over websocket with a server (which I don't control). Upon termination from service side it returns a shutdown code through, what I believe to be, the http status code. However, I fail to find a way to get hold of this http status code through the ktor API. The overall connection looks like this:
Copy code
CoroutineScope(dispatcher).launch {
    client.webSocket(method = Get, host, port) {
        val outboundRoutine = launch { outboundMessages() }
        val inboundRoutine = launch { inboundMessages() }

        outboundRoutine.join()
        inboundRoutine.cancelAndJoin()
    }
    client.close()
    <http://logger.info|logger.info>("Websocket closed")
}
client.webSocket
doesn't return anything. Is there some way to get the status code?
Nevermind. Found it in
DefaultClientWebSocketSession.closeReason
. Somehow I overlooked it.