https://kotlinlang.org logo
#ktor
Title
# ktor
s

Sourabh Rawat

12/08/2020, 12:39 PM
Copy code
fun main() = runBlocking {
    val httpClient = HttpClient {
        install(Logging) {
            level = LogLevel.ALL
        }
        @OptIn(KtorExperimentalAPI::class)
        install(WebSockets)
        expectSuccess = false
        install(JsonFeature) {
            @OptIn(KtorExperimentalAPI::class)
            acceptContentTypes = listOf(ContentType("application", "json-rpc"))
            serializer = KotlinxSerializer()
        }
    }
    val wss =httpClient.webSocketSession(method = HttpMethod.Get, host = "127.0.0.1", port = 6800, path = "/jsonrpc")
    wss.close()
}
this does not stop the program. what am I doing wrong?
image.png
shouldn't it just stop the program after 
wss.close()
 ?
fixed by closing the httpclient.