Hey folks. I'm writing a WebSocket client and I'm ...
# ktor
g
Hey folks. I'm writing a WebSocket client and I'm creating an instance method that calls
HttpClient.webSocket(...)
. All the arguments I'm passing to ktor are honored, except for the `path`: No matter what I set it to, ktor is always using
/
. Here's the code:
Copy code
internal suspend fun wsConnect(
        path: String,
        block: suspend DefaultClientWebSocketSession.() -> Unit
    ) = ktorClient.webSocket(
        HttpMethod.Get,
        hostName, port, path,
        { url(if (useTls) "wss" else "ws", hostName, port, path) },
        block
    )
I'm writing tests for it using OkHTTP3's
MockWebServer
since Ktor doesn't yet offer the ability to test WebSocket clients. So it's an actual server what I'm running in my tests. I've also debugged what
path
webSocket
is getting and it really is the one I'm setting, so why is it still using
/
when it connects to my server?