I'm using Quarkus
coming back at it, after some years and trying to configure for the first time a WS client, but I'm struggling to find a solution.
Related Dependencies in BoM version 3.7.1
- io.quarkus:quarkus-resteasy
- io.quarkus:quarkus-rest-client
- io.quarkus:quarkus-websockets-client. <===
- io.quarkus:quarkus-resteasy-jsonb
Configuring my @ClientEndpoint
and starting the Websocket client with:
ContainerProvider.getWebSocketContainer().connectToServer(RomanWebsocketClient::class.java, URI)
I have 2 outcomes.
- Working URI:
wss://socketsbay.com/wss/v2/1/demo/
(this is just to test the config) - NOT working:
https://myserverdomain/await/some-url-encoded-token
(this is what I want)
The second gives me a 308 Permanent Redirect I have to say that using the same URIs in a ktor based BE works, so I think I'm missing some extra config, like upgrading or so.
What I've tried:
- Declaring a
ClientEndpointConfig.Configurator
to inject the headers ("Connection", "Upgrade", etc.) but didn't work. - Trying to play with Quarkus
application.properties
config, likefollowRedirects
, also didn't work, and I think this could be unrelated.
What I would like to know:
- Do you have any ideas how can I properly define the upgrade (in case this is the issue) ?
- Is it that undertow/netty does not support WS with https protocol ?
- Any other ideas on how to make it work would be great.
Ok, in the end I didn't find a solution, but rather a workaround in case anyone is interested, what I did was just using a
java.net.http.WebSocket
since from Java 11 has a better API.I implemented the
WebSocket.Listener
interface and defined the Client in my case as a Bean register eagerly on startup.I hope at some point to being able to use the Quarkus Websocket client, but for now, this solves the schema issue I had and I'm able to move on.