Hi folks, i'm trying to get my simple websocket cl...
# ktor
t
Hi folks, i'm trying to get my simple websocket client to work with ktor 1.5.0 and the cio engine. When I run it locally I have no issues, but when its bundled inside a jib built docker container (adopt open jdk 14) its hanging:
Copy code
suspend fun connect(host: String, path: String): DefaultClientWebSocketSession {
    val client = HttpClient { install(WebSockets) }
    println("I execute")
    val session = client.webSocketSession {
        url("wss", port = 443, host = host, path = path)
            println("I execute")
        }
        println("I don't execute")
        return session
    }
}
Any thoughts?
I've had the same issue with ktor 1.4.x
I've tried it against two different websocket severs ... The first screenshot is where it hangs when running inside docker. And the 2nd is where it successfully connects when running on my linux machine.
Successful connection:
Tried downgrading to ws and it connects successfully then 🤔 🤷
Hmm it appears to be something with my network or my laptop/os 😞
Update on this in case anyone else runs into the same issue. The container i'm using is a minimal alpine container for the jre ... which doesn't install ca certificates by default and so web sockets cannot verify the server and it hangs. Would be great if there was a better error message! Anyways the fix is simply to add the certificates to the container.