Nail Gilaziev
To use this feature, you need to include io.ktor:ktor-client-websocket artifact.
Deactivated User
val ws = client.webSocketSession(method = HttpMethod.Get, host = "127.0.0.1", port = 8080, path = "/route/path/to/ws") try { ws.pingInterval = Duration.ofMinutes(1) ws.send(Frame.Text("Hello World")) } finally { ws.close() }
val client: HttpClient = HttpClient(...) <http://client.ws|client.ws>(method = HttpMethod.Get, host = "127.0.0.1", port = 8080, path = "/route/path/to/ws") { // this: WebSocketSession (this as DefaultWebSocketSession).pingInterval = Duration.ofMinutes(1) }
A modern programming language that makes developers happier.