@Override public void close(CloseReason closeReason) { super.close(closeReason); webSocketSessionRepository.removeChannel(ctx.channel()); }
@Override public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { Channel channel = ctx.channel(); channel.attr(NettyRxWebSocketSession.WEB_SOCKET_SESSION_KEY).set(null); if (LOG.isDebugEnabled()) { LOG.debug("Removing WebSocket Server session: " + session); } webSocketSessionRepository.removeChannel(channel); try { eventPublisher.publishEvent(new WebSocketSessionClosedEvent(session)); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error("Error publishing WebSocket closed event: " + e.getMessage(), e); } } super.handlerRemoved(ctx); }