Ktor can’t connect to websocket

I have this code:

suspend fun main() { val client = HttpClient(CIO) { install(JsonFeature) { serializer = KotlinxSerializer() } install(WebSockets) } client.wss( method = HttpMethod.Get, host = "gateway.discord.gg", port = 80, path = "/?v9=&encoding=json" ) { } } 

But it gives me an exception:

Exception in thread "main" java.lang.IllegalArgumentException: Invalid TLS record type code: 72 at io.ktor.network.tls.TLSRecordType$Companion.byCode(TLSRecordType.kt:27) at io.ktor.network.tls.ParserKt.readTLSRecord(Parser.kt:19) at io.ktor.network.tls.ParserKt$readTLSRecord$1.invokeSuspend(Parser.kt) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) Process finished with exit code 1 

What am I doing wrong?

submitted by /u/TheLastMinecraft_
[link] [comments]