io.netty.handler.codec.http.websocketx.WebSocketFrame Java Examples

The following examples show how to use io.netty.handler.codec.http.websocketx.WebSocketFrame. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebsocketInboundHandlerTestCase.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
@Test
public void testDoThrottle1() {
    String publisherClass = "publisherClass";
    PowerMockito.mockStatic(DataPublisherUtil.class);
    APIManagerAnalyticsConfiguration apiMngAnalyticsConfig = Mockito.mock(APIManagerAnalyticsConfiguration.class);
    PowerMockito.when(DataPublisherUtil.getApiManagerAnalyticsConfiguration()).thenReturn(apiMngAnalyticsConfig);
    Mockito.when(apiMngAnalyticsConfig.getPublisherClass()).thenReturn(publisherClass);
    //todo
    ChannelHandlerContext channelHandlerContext = Mockito.mock(ChannelHandlerContext.class);
    WebSocketFrame webSocketFrame = Mockito.mock(WebSocketFrame.class);
    WebsocketInboundHandler websocketInboundHandler = new WebsocketInboundHandler() {
        @Override
        protected String getRemoteIP(ChannelHandlerContext ctx) {
            return "localhost";
        }
    };
    try {
        websocketInboundHandler.doThrottle(channelHandlerContext, webSocketFrame);
        fail("Expected NumberFormatException is not thrown.");
    } catch (Exception e) {
        Assert.assertTrue(e instanceof NumberFormatException);
    }
}
 
Example #2
Source File: TextWebSocketFrameHandler.java    From leo-im-server with Apache License 2.0 6 votes vote down vote up
/**
 * 处理WebSocket请求
 * 
 * @param ctx
 * @param frame
 */
private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
    if (frame instanceof CloseWebSocketFrame) {
        handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame.retain());
        ctx.close();
        return;
    }
    // 没有使用WebSocketServerProtocolHandler,所以不会接收到PingWebSocketFrame。
    // if (frame instanceof PingWebSocketFrame) {
    // ctx.writeAndFlush(new PongWebSocketFrame(frame.content().retain()));
    // return;
    // }
    if (!(frame instanceof TextWebSocketFrame)) {
        throw new UnsupportedOperationException(
                String.format("%s frame types not supported", frame.getClass().getName()));
    }

    String request = ((TextWebSocketFrame) frame).text();
    logger.debug("收到客户端发送的数据:" + request);
    // 回复心跳
    if (request.length() == 0) {
        ctx.writeAndFlush(new TextWebSocketFrame(""));
        return;
    }
    this.handleMessage(ctx.channel(), request);
}
 
Example #3
Source File: InboundWebsocketSourceHandler.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
protected void handleWebsocketBinaryFrame(WebSocketFrame frame, MessageContext synCtx) throws AxisFault {
    String endpointName = WebsocketEndpointManager.getInstance().getEndpointName(port, tenantDomain);

    InboundEndpoint endpoint = synCtx.getConfiguration().getInboundEndpoint(endpointName);

    if (endpoint == null) {
        log.error("Cannot find deployed inbound endpoint " + endpointName + "for process request");
        return;
    }

    synCtx.setProperty(InboundWebsocketConstants.WEBSOCKET_BINARY_FRAME_PRESENT, new Boolean(true));
    ((Axis2MessageContext) synCtx).getAxis2MessageContext()
            .setProperty(InboundWebsocketConstants.WEBSOCKET_BINARY_FRAME_PRESENT, new Boolean(true));
    synCtx.setProperty(InboundWebsocketConstants.WEBSOCKET_BINARY_FRAME, frame);
    ((Axis2MessageContext) synCtx).getAxis2MessageContext()
            .setProperty(InboundWebsocketConstants.WEBSOCKET_BINARY_FRAME, frame);

}
 
Example #4
Source File: WebSocketServerHandler.java    From netty4.0.27Learn with Apache License 2.0 6 votes vote down vote up
private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {

        // Check for closing frame
        if (frame instanceof CloseWebSocketFrame) {
            handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame.retain());
            return;
        }
        if (frame instanceof PingWebSocketFrame) {
            ctx.channel().write(new PongWebSocketFrame(frame.content().retain()));
            return;
        }
        if (!(frame instanceof TextWebSocketFrame)) {
            throw new UnsupportedOperationException(String.format("%s frame types not supported", frame.getClass()
                    .getName()));
        }

        // Send the uppercase string back.
        String request = ((TextWebSocketFrame) frame).text();
        System.err.printf("%s received %s%n", ctx.channel(), request);
        ctx.channel().write(new TextWebSocketFrame(request.toUpperCase()));
    }
 
Example #5
Source File: PojoEndpointServer.java    From netty-websocket-spring-boot-starter with Apache License 2.0 6 votes vote down vote up
public void doOnBinary(Channel channel, WebSocketFrame frame) {
    Attribute<String> attrPath = channel.attr(PATH_KEY);
    PojoMethodMapping methodMapping = null;
    if (pathMethodMappingMap.size() == 1) {
        methodMapping = pathMethodMappingMap.values().iterator().next();
    } else {
        String path = attrPath.get();
        methodMapping = pathMethodMappingMap.get(path);
    }
    if (methodMapping.getOnBinary() != null) {
        BinaryWebSocketFrame binaryWebSocketFrame = (BinaryWebSocketFrame) frame;
        Object implement = channel.attr(POJO_KEY).get();
        try {
            methodMapping.getOnBinary().invoke(implement, methodMapping.getOnBinaryArgs(channel, binaryWebSocketFrame));
        } catch (Throwable t) {
            logger.error(t);
        }
    }
}
 
Example #6
Source File: WebSocketServerHandler.java    From netty4.0.27Learn with Apache License 2.0 6 votes vote down vote up
private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {

        // Check for closing frame
        if (frame instanceof CloseWebSocketFrame) {
            handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame.retain());
            return;
        }
        if (frame instanceof PingWebSocketFrame) {
            ctx.write(new PongWebSocketFrame(frame.content().retain()));
            return;
        }
        if (frame instanceof TextWebSocketFrame) {
            // Echo the frame
            ctx.write(frame.retain());
            return;
        }
        if (frame instanceof BinaryWebSocketFrame) {
            // Echo the frame
            ctx.write(frame.retain());
            return;
        }
    }
 
Example #7
Source File: WebSocketUpgradeHandler.java    From selenium with Apache License 2.0 6 votes vote down vote up
private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
  if (frame instanceof CloseWebSocketFrame) {
    handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame);
    // Pass on to the rest of the channel
    ctx.fireChannelRead(frame);
  } else if (frame instanceof PingWebSocketFrame) {
    ctx.write(new PongWebSocketFrame(frame.isFinalFragment(), frame.rsv(), frame.content()));
  } else if (frame instanceof ContinuationWebSocketFrame) {
    ctx.write(frame);
  } else if (frame instanceof PongWebSocketFrame) {
    frame.release();
  } else if (frame instanceof BinaryWebSocketFrame || frame instanceof TextWebSocketFrame) {
    // Allow the rest of the pipeline to deal with this.
    ctx.fireChannelRead(frame);
  } else {
    throw new UnsupportedOperationException(String.format("%s frame types not supported", frame.getClass()
      .getName()));
  }
}
 
Example #8
Source File: HttpServerHandler.java    From ext-opensource-netty with Mozilla Public License 2.0 6 votes vote down vote up
private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
	if (frame instanceof CloseWebSocketFrame) {
		handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame.retain());
		return;
	}
	if (frame instanceof PingWebSocketFrame) {
		ctx.writeAndFlush(new PongWebSocketFrame(frame.content().retain()));
		return;
	}
	if (frame instanceof TextWebSocketFrame) {
		if (webSocketEvent != null) {
			webSocketEvent.onMessageStringEvent(baseServer, new WebSocketSession(ctx.channel()), ((TextWebSocketFrame) frame).text());
		}
		return;
	}
	
	if (frame instanceof BinaryWebSocketFrame) {
		if (webSocketEvent != null) {
			webSocketEvent.onMessageBinaryEvent(baseServer, new WebSocketSession(ctx.channel()), ((BinaryWebSocketFrame)frame).content());
		}
	}
}
 
Example #9
Source File: MessageWsServerHandler.java    From sctalk with Apache License 2.0 6 votes vote down vote up
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {

    if (msg instanceof HttpRequest) {
        logger.debug("HttpRequest");
        // 完成 握手
        handleHttpRequest(ctx, (HttpRequest) msg);
    } else if (msg instanceof IMProtoMessage) {
        super.channelRead(ctx, msg);
    } else if (msg instanceof WebSocketFrame) {
        // websocketService.handleFrame(ctx, (WebSocketFrame) msg);
        // 这句应该走不到
        logger.debug("WebSocketFrame");
    } else {
        logger.debug("other:{}", msg);
    }
}
 
Example #10
Source File: BaseWebSocketServerHandler.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
protected void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
   if (frame instanceof PingWebSocketFrame) {
      if (logger.isTraceEnabled()) {
         logger.trace("Ping with payload [{}]", ByteBufUtil.hexDump(frame.content()));
      }

      PongWebSocketFrame pong = new PongWebSocketFrame(frame.content().retain());
      ctx.writeAndFlush(pong);
   }
   else if (frame instanceof PongWebSocketFrame) {
      PingPong pingPongSession = PingPong.get(ctx.channel());
      if (pingPongSession != null) {
         pingPongSession.recordPong();
      }
   }
   else {
      throw new UnsupportedOperationException(String.format("%s frame types not supported", frame.getClass()
            .getName()));
   }
}
 
Example #11
Source File: AutobahnServerHandler.java    From netty4.0.27Learn with Apache License 2.0 6 votes vote down vote up
private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
    if (logger.isLoggable(Level.FINE)) {
        logger.fine(String.format(
                "Channel %s received %s", ctx.channel().hashCode(), StringUtil.simpleClassName(frame)));
    }

    if (frame instanceof CloseWebSocketFrame) {
        handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame);
    } else if (frame instanceof PingWebSocketFrame) {
        ctx.write(new PongWebSocketFrame(frame.isFinalFragment(), frame.rsv(), frame.content()), ctx.voidPromise());
    } else if (frame instanceof TextWebSocketFrame) {
        ctx.write(frame, ctx.voidPromise());
    } else if (frame instanceof BinaryWebSocketFrame) {
        ctx.write(frame, ctx.voidPromise());
    } else if (frame instanceof ContinuationWebSocketFrame) {
        ctx.write(frame, ctx.voidPromise());
    } else if (frame instanceof PongWebSocketFrame) {
        frame.release();
        // Ignore
    } else {
        throw new UnsupportedOperationException(String.format("%s frame types not supported", frame.getClass()
                .getName()));
    }
}
 
Example #12
Source File: WebSocketServerHandler.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
public void channelRead0(ChannelHandlerContext ctx, Object msg) {
    if (msg instanceof FullHttpRequest) {
        handleHttpRequest(ctx, (FullHttpRequest) msg);
    } else if (msg instanceof WebSocketFrame) {
        handleWebSocketFrame(ctx, (WebSocketFrame) msg);
    }
}
 
Example #13
Source File: PerMessageDeflateEncoder.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
protected void encode(ChannelHandlerContext ctx, WebSocketFrame msg,
        List<Object> out) throws Exception {
    super.encode(ctx, msg, out);

    if (msg.isFinalFragment()) {
        compressing = false;
    } else if (msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame) {
        compressing = true;
    }
}
 
Example #14
Source File: NettyServer.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
    LOG.trace("NettyServerHandler: Channel read: {}", msg);
    if (msg instanceof WebSocketFrame) {
        WebSocketFrame frame = (WebSocketFrame) msg;
        ctx.fireChannelRead(frame.content());
    } else if (msg instanceof FullHttpRequest) {
        // Reject anything not on the WebSocket path
        FullHttpRequest request = (FullHttpRequest) msg;
        sendHttpResponse(ctx, request, new DefaultFullHttpResponse(HTTP_1_1, BAD_REQUEST));
    } else {
        // Forward anything else along to the next handler.
        ctx.fireChannelRead(msg);
    }
}
 
Example #15
Source File: ProtocolWebSocketServerHandler.java    From hxy-socket with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void doMessage(ChannelHandlerContext ctx, WebSocketFrame frame) {
    if (frame instanceof BinaryWebSocketFrame) {
        byte[] contentBytes = new byte[frame.content().readableBytes()];
        frame.content().readBytes(contentBytes);
        doHandler(() -> socketMsgHandler.onMessage(ctx, contentBytes), ctx);
    }
}
 
Example #16
Source File: PerFrameDeflateEncoder.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean acceptOutboundMessage(Object msg) throws Exception {
    return (msg instanceof TextWebSocketFrame ||
            msg instanceof BinaryWebSocketFrame ||
            msg instanceof ContinuationWebSocketFrame) &&
                ((WebSocketFrame) msg).content().readableBytes() > 0 &&
                (((WebSocketFrame) msg).rsv() & WebSocketExtension.RSV1) == 0;
}
 
Example #17
Source File: AbstractHandler.java    From InChat with Apache License 2.0 5 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
    if (msg instanceof TextWebSocketFrame){
        System.out.println("TextWebSocketFrame"+msg);
        textdoMessage(ctx,(TextWebSocketFrame)msg);
    }else if (msg instanceof WebSocketFrame){
        System.out.println("WebSocketFrame"+msg);
        webdoMessage(ctx,(WebSocketFrame)msg);
    }else if (msg instanceof FullHttpRequest){
        System.out.println("FullHttpRequest"+msg);
        httpdoMessage(ctx,(FullHttpRequest)msg);
    }
}
 
Example #18
Source File: WebsocketTest.java    From reactor-netty with Apache License 2.0 5 votes vote down vote up
@Test
public void testIssue663_4() {
	FluxIdentityProcessor<WebSocketFrame> incomingData = Processors.more().multicastNoBackpressure();

	httpServer =
			HttpServer.create()
			          .port(0)
			          .handle((req, resp) -> resp.sendWebsocket((i, o) -> i.receiveFrames().then(),
			                  WebsocketServerSpec.builder().handlePing(true).build()))
			          .wiretap(true)
			          .bindNow();

	HttpClient.create()
	          .port(httpServer.port())
	          .wiretap(true)
	          .websocket()
	          .uri("/")
	          .handle((in, out) ->
	              out.sendObject(Flux.just(new PingWebSocketFrame(), new CloseWebSocketFrame())
	                                 .delayElements(Duration.ofMillis(100)))
	                 .then(in.receiveFrames()
	                         .subscribeWith(incomingData)
	                         .then()))
	          .subscribe();

	StepVerifier.create(incomingData)
	            .expectComplete()
	            .verify(Duration.ofSeconds(30));
}
 
Example #19
Source File: WsServerHandler.java    From wind-im with Apache License 2.0 5 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
	if (msg instanceof FullHttpRequest) {
		// http 请求握手
		doHttpRequest(ctx, (FullHttpRequest) msg);
	} else if (msg instanceof WebSocketFrame) {
		// websocket 请求
		doWSRequest(ctx, (WebSocketFrame) msg);
	} else {
		// 错误请求,关闭连接
		ctx.close();
	}

}
 
Example #20
Source File: Ipcd10WebSocketServerHandler.java    From arcusipcd with Apache License 2.0 5 votes vote down vote up
@Override
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
    if (msg instanceof FullHttpRequest) {
        handleHttpRequest(ctx, (FullHttpRequest) msg);
    } else if (msg instanceof WebSocketFrame) {
        handleWebSocketFrame(ctx, (WebSocketFrame) msg);
    }
}
 
Example #21
Source File: WebSocketFrameHandler.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext ctx, WebSocketFrame frame) throws Exception {
    // ping and pong frames already handled

    if (frame instanceof TextWebSocketFrame) {
        // Send the uppercase string back.
        String request = ((TextWebSocketFrame) frame).text();
        logger.info("{} received {}", ctx.channel(), request);
        ctx.channel().writeAndFlush(new TextWebSocketFrame(request.toUpperCase(Locale.US)));
    } else {
        String message = "unsupported frame type: " + frame.getClass().getName();
        throw new UnsupportedOperationException(message);
    }
}
 
Example #22
Source File: WebSocketEchoServer.java    From karyon with Apache License 2.0 5 votes vote down vote up
public static void main(final String[] args) {
    RxServer<TextWebSocketFrame, TextWebSocketFrame> webSocketServer = RxNetty.newWebSocketServerBuilder(
            8888,
            new ConnectionHandler<TextWebSocketFrame, TextWebSocketFrame>() {
                @Override
                public Observable<Void> handle(final ObservableConnection<TextWebSocketFrame, TextWebSocketFrame> connection) {
                    return connection.getInput().flatMap(new Func1<WebSocketFrame, Observable<Void>>() {
                        @Override
                        public Observable<Void> call(WebSocketFrame wsFrame) {
                            TextWebSocketFrame textFrame = (TextWebSocketFrame) wsFrame;
                            System.out.println("Got message: " + textFrame.text());
                            return connection.writeAndFlush(new TextWebSocketFrame(textFrame.text().toUpperCase()));
                        }
                    });
                }
            }
    ).build();
    Karyon.forWebSocketServer(
            webSocketServer,
            new KaryonBootstrapModule(),
            new ArchaiusBootstrapModule("websocket-echo-server"),
            // KaryonEurekaModule.asBootstrapModule(), /* Uncomment if you need eureka */
            Karyon.toBootstrapModule(KaryonWebAdminModule.class),
            ShutdownModule.asBootstrapModule(),
            KaryonServoModule.asBootstrapModule())
            .startAndWaitTillShutdown();
}
 
Example #23
Source File: WebSocketServerHandler.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
   if (msg instanceof FullHttpRequest) {
      handleHttpRequest(ctx, (FullHttpRequest) msg);
   } else if (msg instanceof WebSocketFrame) {
      WebSocketFrame frame = (WebSocketFrame) msg;
      boolean handle = handleWebSocketFrame(ctx, frame);
      if (handle) {
         ctx.fireChannelRead(frame.content().retain());
      }
   }
}
 
Example #24
Source File: WebsocketSinkServerHandler.java    From spring-cloud-stream-app-starters with Apache License 2.0 5 votes vote down vote up
private void addTraceForFrame(WebSocketFrame frame, String type) {
	Map<String, Object> trace = new LinkedHashMap<>();
	trace.put("type", type);
	trace.put("direction", "in");
	if (frame instanceof TextWebSocketFrame) {
		trace.put("payload", ((TextWebSocketFrame) frame).text());
	}

	if (traceEnabled) {
		websocketTraceRepository.add(trace);
	}
}
 
Example #25
Source File: WebSocketClientHandler.java    From ext-opensource-netty with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
	if (msg instanceof FullHttpResponse) {
		handleHttpResponse(ctx, (FullHttpResponse) msg);
	} else if (msg instanceof WebSocketFrame) {
		handleWebSocketFrame(ctx, (WebSocketFrame) msg);
	} else {
	}
}
 
Example #26
Source File: DefaultWebSocketHttpResponse.java    From netty-reactive-streams with Apache License 2.0 5 votes vote down vote up
public DefaultWebSocketHttpResponse(HttpVersion version, HttpResponseStatus status,
                                    Processor<WebSocketFrame, WebSocketFrame> processor,
                                    WebSocketServerHandshakerFactory handshakerFactory) {
    super(version, status);
    this.processor = processor;
    this.handshakerFactory = handshakerFactory;
}
 
Example #27
Source File: WebSocketServerHandler.java    From tools-journey with Apache License 2.0 5 votes vote down vote up
@Override
public void channelRead0(ChannelHandlerContext ctx, Object msg) {
    if (msg instanceof FullHttpRequest) {
        handleHttpRequest(ctx, (FullHttpRequest) msg);
    } else if (msg instanceof WebSocketFrame) {
        handleWebSocketFrame(ctx, (WebSocketFrame) msg);
    }
}
 
Example #28
Source File: RequestPacket.java    From litchi with Apache License 2.0 5 votes vote down vote up
public static RequestPacket valueOfHandler(WebSocketFrame frame, long uid) {
        RequestPacket request = new RequestPacket();

        //uid
        request.uid = uid;

        //messageId
        ByteBuf message = frame.content();
        request.messageId = message.readShort();

        //route
        byte[] routeBytes = new byte[message.readByte()];
        message.readBytes(routeBytes);
        request.route = new String(routeBytes);

        //data
        byte[] data = new byte[message.readShort()];
        message.readBytes(data);
        request.args = new Object[1];
        request.args[0] = data;

//			long crc = message.readLong();
//			byte[] array = message.array();
//			//数据包正确性验证
//			if (crc != CRCUtils.calculateCRC(Parameters.CRC32, array, 0, array.length - 8)) {
//				LOGGER.error("request packet crc error. crc={} array={}", crc, Arrays.toString(array));
//				return;
//			}

        return request;
    }
 
Example #29
Source File: WebsocketTest.java    From reactor-netty with Apache License 2.0 5 votes vote down vote up
@Test
public void testIssue663_2() {
	FluxIdentityProcessor<WebSocketFrame> incomingData = Processors.more().multicastNoBackpressure();

	httpServer =
			HttpServer.create()
			          .port(0)
			          .handle((req, resp) ->
			              resp.sendWebsocket((i, o) ->
			                  o.sendObject(Flux.just(new PingWebSocketFrame(), new CloseWebSocketFrame())
			                   .delayElements(Duration.ofMillis(100)))
			                   .then(i.receiveFrames()
			                          .subscribeWith(incomingData)
			                          .then())))
			          .wiretap(true)
			          .bindNow();

	HttpClient.create()
	          .port(httpServer.port())
	          .wiretap(true)
	          .websocket(WebsocketClientSpec.builder().handlePing(true).build())
	          .uri("/")
	          .handle((in, out) -> in.receiveFrames())
	          .subscribe();

	StepVerifier.create(incomingData)
	            .expectComplete()
	            .verify(Duration.ofSeconds(30));
}
 
Example #30
Source File: WebSocketServerHandler.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
@Override
public void channelRead0(ChannelHandlerContext ctx, Object msg) {
    if (msg instanceof FullHttpRequest) {
        handleHttpRequest(ctx, (FullHttpRequest) msg);
    } else if (msg instanceof WebSocketFrame) {
        handleWebSocketFrame(ctx, (WebSocketFrame) msg);
    }
}