コード例 #1
0
 @Override
 public void onOpen(WebSocket.Connection connection) {
   try {
     webSocketProcessor =
         (WebSocketProcessor)
             JettyWebSocketHandler.class
                 .getClassLoader()
                 .loadClass(webSocketProcessorClassName)
                 .getDeclaredConstructor(
                     new Class[] {AtmosphereServlet.class, WebSocketSupport.class})
                 .newInstance(
                     new Object[] {atmosphereServlet, new Jetty8WebSocketSupport(connection)});
     webSocketProcessor.connect(new JettyRequestFix(request));
   } catch (Exception e) {
     logger.warn("failed to connect to web socket", e);
   }
 }
コード例 #2
0
 @Override
 public boolean onControl(byte controlCode, byte[] data, int offset, int length) {
   webSocketProcessor.broadcast(data, offset, length);
   return false;
 }
コード例 #3
0
 @Override
 public void onMessage(byte[] data, int offset, int length) {
   webSocketProcessor.broadcast(data, offset, length);
 }
コード例 #4
0
 @Override
 public void onDisconnect() {
   webSocketProcessor.close();
 }
コード例 #5
0
 @Override
 public void onFragment(boolean more, byte opcode, byte[] data, int offset, int length) {
   webSocketProcessor.broadcast(new String(data, offset, length));
 }
コード例 #6
0
 @Override
 public void onMessage(byte frame, byte[] data, int offset, int length) {
   webSocketProcessor.broadcast(new String(data, offset, length));
 }
コード例 #7
0
 @Override
 public void onMessage(byte frame, String data) {
   webSocketProcessor.broadcast(data);
 }
コード例 #8
0
 @Override
 public void onClose(int closeCode, String message) {
   webSocketProcessor.close();
 }
コード例 #9
0
 @Override
 public boolean onFrame(byte flags, byte opcode, byte[] data, int offset, int length) {
   webSocketProcessor.broadcast(data, offset, length);
   logger.debug("WebSocket.onFrame");
   return false;
 }