Hey everyone.
I'm currently workin on a websocket Server based on netty 4.1.2.
My Problem is, when i change my pipeline durring runtime, it has no
effects. I want to replace a handler with another one.
public class FrameHandlerLogin extends
> SimpleChannelInboundHandler<WebSocketFrame> {
> private String USER = "aUser";
> private String PASSWORD = "aPassword";
>
>
>
>
>
> protected void channelRead0(ChannelHandlerContext ctx, WebSocketFrame
> frame) throws Exception {
> String recievedUser;
> String recievedPsw;
>
>
> if (frame instanceof TextWebSocketFrame) {
> //some JSON sutff, not important
>
> if (recievedUser.equals(USER) && recievedPsw.equals(PASSWORD)
> ) {
> System.out.println("Recieved correct User and Password!");
>
> ctx.pipeline().remove("HandlerLogin");
> ctx.pipeline().addLast("HandlerSQL", new
> FrameHandlerSQL());
> ctx.channel().writeAndFlush(new
> TextWebSocketFrame("Success"));
>
>
> } else if (request.equals("Stop")) {
> System.out.println("Recieved Stop");
> ctx.close();
> } else {
> ctx.channel().writeAndFlush(
> new TextWebSocketFrame("Password wrong."));
> }
> } else {
>
> String message = "unsupported frame type: " +
> frame.getClass().getName();
> throw new UnsupportedOperationException(message);
> }
>
> }
> }
>
I thought it is possible to change the pipeline? But why does it take no
effect?
--
You received this message because you are subscribed to the Google Groups
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/netty/86e7667e-ef50-4f09-ae40-909987baf4c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.