0

My spring websocket code runs in Liberty server. The code works fine in local. When I move to my server, when I try from 'Simple Websocket Client', I get an error like

WebSocket connection to 'wss://url' failed: One or more reserved bits are on: reserved1 = 0, reserved2 = 1, reserved3 = 1

On the server side logs, I can see that afterConnectionEstablished method gets triggered, and immediately afterConnectionClosed gets triggered and when I print close status, it gives me

Code 1002 Reason:: Invalid reserved bit.

Am not clear on what this means and what are reasons this could come from.

public class NotificationHandler extends TextWebSocketHandler {

    Logger logger = LogManager.getLogger(NotificationHandler.class);


    @Override
    public void afterConnectionEstablished(WebSocketSession session)
            throws IOException {
        logger.info("In NotificationHandler, afterConnectionEstablished.. ");
        session.sendMessage(new TextMessage("Hello !"));
    }

    @Override
    public void handleTextMessage(WebSocketSession session, TextMessage message) throws IOException {
        logger.info("In NotificationHandler, handleTextMessage.. ");
        session.sendMessage(new TextMessage("Hello Text Message!"));
    }

    @Override
    public void afterConnectionClosed(WebSocketSession session, CloseStatus status) {
        logger.info("In NotificationHandler, afterConnectionClosed, Code:: "+ status.getCode() + ".. Reason:: " + status.getReason());
    }

}

Please let me know if you need more details.

csharpnewbie
  • 789
  • 2
  • 12
  • 33

1 Answers1

0

Given the exact wording, that is not a reason code coming from the Liberty Websocket code, so I am guessing it is coming from the Spring code. If you are running on Liberty I would think you would want the system configured to use the Liberty Websocket code and not another provider.

Bill_W_71
  • 26
  • 2
  • Spring Websockets is just the library, which behind the scenes uses the runtime server libraries for the actual connection. When I run on tomcat, it picks up tomcat's websocket classes vs running on Liberty uses Websphere Websocket code. – csharpnewbie Apr 30 '19 at 17:27