I try to connect to my ktor server from my ktor cl...
# ktor
I try to connect to my ktor server from my ktor client using websocket. I cannot figure out why I get this exception on the client:
Copy code
Exception in thread "main" io.ktor.client.call.NoTransformationFoundException: No transformation found: class io.ktor.utils.io.ByteBufferChannel -> class io.ktor.client.plugins.websocket.DefaultClientWebSocketSession
with response from <http://localhost:10150/remoting/websocket>:
status: 400 Bad Request
response headers: 
content-length: 0
That's because the server replied with 400 Bad Request status code instead of expected 101 Switching Protocols.
You need to figure out how to send a valid request.
Maybe could you help where should I look for? Like where to debug the issue. I have developed my code using
and the tests run as expected. But when I switched to Netty server and CIO/Java client, the client receives the above mentioned 400 error when connecting using websockets :(
I see this in the server log:
Copy code
      /remoting/websocket/(method:GET), segment:2 -> SUCCESS @ /remoting/websocket/(method:GET)
        /remoting/websocket/(method:GET)/(header:Connection = Upgrade), segment:2 -> FAILURE "Selector didn't match" @ /remoting/websocket/(method:GET)/(header:Connection = Upgrade)
Does it mean that the client should send a
header but it does not? The client log contains this:
Copy code
2023-06-23 18:51:21,026 TRACE [ktor-client-java-3] i.k.client.plugins.websocket.WebSockets - Skipping WebSocket plugin for non-websocket request: <http://localhost:10150/remoting/websocket>
I'm confused, the client tries to connect using
, why does this call result in a non-websocket request?
Ehhh, I forgot to use the correct
protocol, I used