java.io.IOException: Invalid Status code=200 text=OK
supertick opened this issue · 3 comments
Hello !
I'm attempting to setup a websocket with AsyncHttpClient similar to how its setup here - https://www.baeldung.com/async-http-client-websockets
But I always get the same error and closing of the socket.
java.io.IOException: Invalid Status code=200 text=OK
Any ideas of what I might try ?
I know the websocket server is working ... I tested it with a browser plugin and I can see the messages streaming

Can you show stack trace?
No need for a stacktrace.
java.io.IOException: Invalid Status code=200 text=OK
This error is very clear (at least to me): your server replied to the HTTP request opening the WebSocket with a 200 OK status, which is invalid for a WebSocket. It should be 101 Switching Protocols.
My best guess is that your url is incorrect, eg using the http scheme instead of the ws one, or not providing the expected parameters and being redirected.
As @slandelle mentioned.