/** * Invoked after the WebSocket connection has been closed by either side, or after a * transport error has occurred. Although the session may technically still be open, * depending on the underlying implementation, sending messages at this point is * discouraged and most likely will not succeed. */ @Override public void afterConnectionClosed(final WebSocketSession session, CloseStatus status) throws Exception { if (!status.equalsCode(CloseStatus.NORMAL)) { log.warn("[Handler::afterConnectionClosed] status: {}, sessionId: {}", status, session.getId()); } stop(session); }
@Override public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { log.debug("Connection Closed[{}], CloseStatus={}.", this.getName(), status); Heartbeat heartbeat = webSocketManager.getHeartbeat(); if (heartbeat != null) { heartbeat.stop(); } this.session = null; // normal close if (CloseStatus.NORMAL.equalsCode(status)) { log.info("Connection[{}] is normally closed.", this.getName()); return; } // abnormal close log.error("Connection[{}] is abnormally closed, CloseStatus={}.", this.getName(), status); abnormalConnectionClosedListener.accept(status); }