类 WebSocketServerHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.websocketx.TextWebSocketFrame>
com.cdkjframework.web.socket.netty.WebSocketServerHandler
所有已实现的接口:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

@Component @Sharable public class WebSocketServerHandler extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.websocketx.TextWebSocketFrame>
  • 嵌套类概要

    从接口继承的嵌套类/接口 io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • 构造器概要

    构造器
    构造器
    说明
    构造函数
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    channelInactive(io.netty.channel.ChannelHandlerContext ctx)
    有客户端终止连接服务器会触发此函数
    void
    channelReadComplete(io.netty.channel.ChannelHandlerContext ctx)
    数据读取完毕
    void
    exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
    处理异常, 一般是需要关闭通道
    void
    handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
    客户端连接之后获取客户端channel并放入group中管理

    从类继承的方法 io.netty.channel.SimpleChannelInboundHandler

    acceptInboundMessage, channelRead

    从类继承的方法 io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered

    从类继承的方法 io.netty.channel.ChannelHandlerAdapter

    handlerRemoved, isSharable

    从类继承的方法 java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    从接口继承的方法 io.netty.channel.ChannelHandler

    handlerRemoved
  • 构造器详细资料

    • WebSocketServerHandler

      public WebSocketServerHandler(WebSocket webSocket)
      构造函数
      参数:
      webSocket - 接口
  • 方法详细资料

    • channelReadComplete

      public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      数据读取完毕
      指定者:
      channelReadComplete 在接口中 io.netty.channel.ChannelInboundHandler
      覆盖:
      channelReadComplete 在类中 io.netty.channel.ChannelInboundHandlerAdapter
      参数:
      ctx - 通道
      抛出:
      Exception - 异常信息
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception
      处理异常, 一般是需要关闭通道
      指定者:
      exceptionCaught 在接口中 io.netty.channel.ChannelHandler
      指定者:
      exceptionCaught 在接口中 io.netty.channel.ChannelInboundHandler
      覆盖:
      exceptionCaught 在类中 io.netty.channel.ChannelInboundHandlerAdapter
      参数:
      ctx - 通道处理程序上下文
      cause - 异常数据
      抛出:
      Exception - 异常信息
    • handlerAdded

      public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      客户端连接之后获取客户端channel并放入group中管理
      指定者:
      handlerAdded 在接口中 io.netty.channel.ChannelHandler
      覆盖:
      handlerAdded 在类中 io.netty.channel.ChannelHandlerAdapter
      参数:
      ctx - 通道处理程序上下文
      抛出:
      Exception - 异常信息
    • channelInactive

      public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      有客户端终止连接服务器会触发此函数
      指定者:
      channelInactive 在接口中 io.netty.channel.ChannelInboundHandler
      覆盖:
      channelInactive 在类中 io.netty.channel.ChannelInboundHandlerAdapter
      参数:
      ctx - 通道进程
      抛出:
      Exception - 异常信息