Vivek
Vivek

Reputation: 21

Caused by: org.glassfish.tyrus.websockets.HandshakeException: Response code was not 101: 403

final ClientEndpointConfig cec = ClientEndpointConfig.Builder.create().build();

            ClientManager client = ClientManager.createClient();
            client.connectToServer(new Endpoint() {

                @Override
                public void onOpen(Session session, EndpointConfig config) {
                    try {
                        session.addMessageHandler((MessageHandler.Whole<String>) message -> {
                            System.out.println("Received message: "+message);
                        });
                        session.getBasicRemote().sendText(SENT_MESSAGE);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }, cec, new URI("ws://localhost:8080/websocket"));
        } catch (Exception e) {
            e.printStackTrace();
        }

using tyrus-client here and making a websocket client connection a spring boot websocket server

Upvotes: 0

Views: 532

Answers (0)

Related Questions