Nail Gilaziev
04/24/2018, 9:21 AMTo use this feature, you need to include io.ktor:ktor-client-websocket artifact.
Deactivated User
04/24/2018, 10:59 AMDeactivated User
04/24/2018, 11:10 AMval 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()
}
or
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)
}
This small inconvenience will be addressed soonNail Gilaziev
04/25/2018, 8:55 AM