@Component
@ChannelHandler.Sharable
public class WebSocketHandler
extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.websocketx.WebSocketFrame>
| 构造器和说明 |
|---|
WebSocketHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
channelRead0(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.websocketx.WebSocketFrame frame)
收到WebSocket消息帧
|
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
发生异常时调用
|
void |
handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
连接建立时调用
|
void |
handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) |
protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.websocketx.WebSocketFrame frame)
throws Exception
channelRead0 在类中 io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.websocketx.WebSocketFrame>ctx - 客户端frame - 消息帧Exceptionpublic void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
handlerAdded 在接口中 io.netty.channel.ChannelHandlerhandlerAdded 在类中 io.netty.channel.ChannelHandlerAdapterctx - 客户端public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
handlerRemoved 在接口中 io.netty.channel.ChannelHandlerhandlerRemoved 在类中 io.netty.channel.ChannelHandlerAdapterpublic void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
throws Exception
exceptionCaught 在接口中 io.netty.channel.ChannelHandlerexceptionCaught 在接口中 io.netty.channel.ChannelInboundHandlerexceptionCaught 在类中 io.netty.channel.ChannelInboundHandlerAdapterctx - 客户端cause - 异常ExceptionCopyright © 2024. All rights reserved.