コード例 #1
0
 @OnWebSocketError
 public void onWebSocketError(Throwable cause) {
   try {
     this.webSocketHandler.handleTransportError(this.wsSession, cause);
   } catch (Throwable t) {
     ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, t, logger);
   }
 }
コード例 #2
0
 @OnWebSocketMessage
 public void onWebSocketBinary(byte[] payload, int offset, int length) {
   BinaryMessage message = new BinaryMessage(payload, offset, length, true);
   try {
     this.webSocketHandler.handleMessage(this.wsSession, message);
   } catch (Throwable t) {
     ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, t, logger);
   }
 }
コード例 #3
0
 @OnWebSocketMessage
 public void onWebSocketText(String payload) {
   TextMessage message = new TextMessage(payload);
   try {
     this.webSocketHandler.handleMessage(this.wsSession, message);
   } catch (Throwable t) {
     ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, t, logger);
   }
 }
コード例 #4
0
 @OnWebSocketConnect
 public void onWebSocketConnect(Session session) {
   try {
     this.wsSession.initializeNativeSession(session);
     this.webSocketHandler.afterConnectionEstablished(this.wsSession);
   } catch (Throwable t) {
     ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, t, logger);
   }
 }
コード例 #5
0
 @OnWebSocketFrame
 public void onWebSocketFrame(Frame frame) {
   if (OpCode.PONG == frame.getOpCode()) {
     ByteBuffer payload = frame.getPayload() != null ? frame.getPayload() : EMPTY_PAYLOAD;
     PongMessage message = new PongMessage(payload);
     try {
       this.webSocketHandler.handleMessage(this.wsSession, message);
     } catch (Throwable t) {
       ExceptionWebSocketHandlerDecorator.tryCloseWithError(this.wsSession, t, logger);
     }
   }
 }