dpalmna
dpalmna

Reputation: 1

Upgrade code from org.eclipse.jetty.websocket.websocket-client to org.eclipse.jetty.websocket.websocket-jakarta-client

I have the following application code in an application that I would like to migrate to Spring3 in order to do so javax is replaced with jakarta.

Any one have any Idea how to migrate the following code:

// Let's create and start the Web Socket
//
// For internal test, we have a self-signed certificate. So we need to short cut certificate check.
// DO NOT DO THAT IN PRODUCTION!
boolean trustAll = (System.getProperty("com.graphql-java-generator.websocket.nosslcheck") != null);
org.eclipse.jetty.util.ssl.SslContextFactory.Client sslContextFactory = new org.eclipse.jetty.util.ssl.SslContextFactory.Client(
                trustAll);
org.eclipse.jetty.client.HttpClient httpClient = new HttpClient(sslContextFactory);
org.eclipse.jetty.websocket.client.WebSocketClient wsClient = new WebSocketClient(httpClient);
SubscriptionClientWebSocket<R, T> subscriptionClientWebSocket = new SubscriptionClientWebSocket<R, T>(request,
                subscriptionName, subscriptionCallback, subscriptionType, messageType,
                graphQLRequest.getGraphQLObjectMapper());
URI uri = getWebSocketURI();
try {
    wsClient.start();
    org.eclipse.jetty.websocket.client.ClientUpgradeRequest clientUpgradeRequest = new ClientUpgradeRequest();
    wsClient.connect(subscriptionClientWebSocket, uri, clientUpgradeRequest);
    logger.debug("Connecting to {}", uri);
} catch (Exception e) {
    String msg = "Error while opening the Web Socket connection to " + uri;
    logger.error(msg);
    throw new GraphQLRequestExecutionException(msg, e);
}

Having not found any documentation on how to proceed with this migration.

Tried using the JakartaWebSocketClientContainer but could not find how to use with an UpgradeRequest

Upvotes: 0

Views: 519

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49545

Your code is not using javax.websocket, so there's nothing to upgrade.

The techniques you are using in your code to manage the SSL behavior is also not possible in either javax.websocket or jakarta.websocket (There is no API you can use to manage SSL/TLS in those)

Upvotes: 0

Related Questions