Could I get a quick code review please? Is the use...
# getting-started
t
Could I get a quick code review please? Is the use of while-true and runBlocking OK here?
Copy code
class WsClient {
    private val url = "<http://example.com>"
    private val httpClient = HttpClient { install(WebSockets) }

    suspend fun start() {
        httpClient.wss(HttpMethod.Get, url) {
            send("Hello")
            while (true) {
                when (val frame = incoming.receive()) {
                    is Frame.Text -> println(frame.readText())
                    is Frame.Binary -> println(frame.readBytes())
                }
            }
        }
    }
}

fun main() = runBlocking {
    WsClient().start()
}
m
there’s a dedicated channel #codereview, try posting there
t
👍 thanks