List of usage examples for org.springframework.web.socket CloseStatus GOING_AWAY
CloseStatus GOING_AWAY
To view the source code for org.springframework.web.socket CloseStatus GOING_AWAY.
Click Source Link
From source file:com.company.project.config.StompDisconnectEvent.java
@Override public void onApplicationEvent(SessionDisconnectEvent event) { StompHeaderAccessor sha = StompHeaderAccessor.wrap(event.getMessage()); CloseStatus status = event.getCloseStatus(); if (status.equals(CloseStatus.BAD_DATA)) { System.out.println("CloseStatus.BAD_DATA"); }/* w ww. j a va2s. com*/ if (status.equals(CloseStatus.GOING_AWAY)) { System.out.println("CloseStatus.GOING_AWAY"); } if (status.equals(CloseStatus.NORMAL)) { System.out.println("CloseStatus.NORMAL"); } if (status.equals(CloseStatus.NOT_ACCEPTABLE)) { System.out.println("CloseStatus.NOT_ACCEPTABLE"); } if (status.equals(CloseStatus.NO_CLOSE_FRAME)) { System.out.println("CloseStatus.NO_CLOSE_FRAME"); } if (status.equals(CloseStatus.NO_STATUS_CODE)) { System.out.println("CloseStatus.NO_STATUS_CODE"); } if (status.equals(CloseStatus.POLICY_VIOLATION)) { System.out.println("CloseStatus.POLICY_VIOLATION"); } if (status.equals(CloseStatus.PROTOCOL_ERROR)) { System.out.println("CloseStatus.PROTOCOL_ERROR"); } if (status.equals(CloseStatus.REQUIRED_EXTENSION)) { System.out.println("CloseStatus.REQUIRED_EXTENSION"); } if (status.equals(CloseStatus.SERVER_ERROR)) { System.out.println("CloseStatus.SERVER_ERROR"); } if (status.equals(CloseStatus.SERVICE_RESTARTED)) { System.out.println("CloseStatus.SERVICE_RESTARTED"); } if (status.equals(CloseStatus.SESSION_NOT_RELIABLE)) { System.out.println("CloseStatus.SESSION_NOT_RELIABLE"); } if (status.equals(CloseStatus.TLS_HANDSHAKE_FAILURE)) { System.out.println("CloseStatus.TLS_HANDSHAKE_FAILURE"); } if (status.equals(CloseStatus.TOO_BIG_TO_PROCESS)) { System.out.println("CloseStatus.TOO_BIG_TO_PROCESS"); } System.out.println("CloseStatus: " + status); logger.debug("Disconnect event [sessionId: " + sha.getSessionId() + " ]"); System.out.println("Disconnect event [sessionId: " + event.getSessionId() + " ]"); }
From source file:com.codeveo.lago.bot.stomp.client.WebSocketStompSession.java
public void disconnect() { StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.DISCONNECT); Message<byte[]> message = MessageBuilder.withPayload(EMPTY_PAYLOAD).setHeaders(headers).build(); sendInternal(message);/*from w w w. j a va 2 s.c om*/ try { this.webSocketSession.close(CloseStatus.GOING_AWAY); } catch (IOException e) { throw new IllegalStateException(e); } }
From source file:org.springframework.integration.websocket.IntegrationWebSocketContainer.java
@Override public void destroy() throws Exception { try {/*from ww w . j a v a 2s. co m*/ // Notify sessions to stop flushing messages for (WebSocketSession session : this.sessions.values()) { try { session.close(CloseStatus.GOING_AWAY); } catch (Exception e) { this.logger.error("Failed to close session id '" + session.getId() + "': " + e.getMessage()); } } } finally { this.sessions.clear(); } }
From source file:org.springframework.web.socket.messaging.SubProtocolWebSocketHandler.java
@Override public final void stop() { synchronized (this.lifecycleMonitor) { this.running = false; this.clientOutboundChannel.unsubscribe(this); for (WebSocketSessionHolder holder : this.sessions.values()) { try { holder.getSession().close(CloseStatus.GOING_AWAY); } catch (Throwable ex) { if (logger.isWarnEnabled()) { logger.warn("Failed to close '" + holder.getSession() + "': " + ex); }/*from w w w .j av a2 s. c om*/ } } } }