A client opens a WebSocket connection and then closes the WebSocket with status code 1000 by calling
webSocketSession.close(1000, "normal-close of WebSocket session").
On the on-close WebSocket handler:
@OnWebSocketClose
public void onClose(Session client, int statusCode, String message)
I am getting the statusCode of 1006 which is for AbruptDisconnect. So, it means the WebSocket is not closed normally but abruptly.
I get 1006 status-code with jetty-version : 9.4.20.v20190813. However, with jetty-version: 9.4.6.v20170531, I get the correct status code in on-close WebSocket Handler (@OnWebSocketClose) i.e 1000. It means that with older jetty-version, webSocket is closed normally
Another observation is with newer jetty-version(9.4.20.v20190813), as soon as the client closes the WebSocket normally, on-close WebSocket handler (@OnWebSocketClose) is invoked and gives 1006 status code. However, with older jetty-version(9.4.6.v20170531), it takes around 400-500 ms to invoke the on-close handle of WebSocket (@OnWebSocketClose) after normal disconnect of WebSocket.
Is something changed on how the session is disconnected in the new jetty or is this a regression issue?