public class WebSocketServerProtocolHandler extends MessageToMessageDecoder<WebSocketFrame>
ChannelInboundHandler.userEventTriggered(ChannelHandlerContext, Object)
并检查事件是否为WebSocketServerProtocolHandler.HandshakeComplete
的实例,该事件将包含有关握手的额外信息,例如请求和所选的子协议。
Modifier and Type | Class and Description |
---|---|
static class |
WebSocketServerProtocolHandler.HandshakeComplete
握手成功完成,频道升级为网络套接字。
|
static class |
WebSocketServerProtocolHandler.ServerHandshakeStateEvent
为了通知握手状态而触发的事件
|
ChannelHandler.Sharable
Constructor and Description |
---|
WebSocketServerProtocolHandler(java.lang.String websocketPath) |
WebSocketServerProtocolHandler(java.lang.String websocketPath, boolean checkStartsWith) |
WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols) |
WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols, boolean allowExtensions) |
WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols, boolean allowExtensions, int maxFrameSize) |
WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols, boolean allowExtensions, int maxFrameSize, boolean allowMaskMismatch) |
WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols, boolean allowExtensions, int maxFrameSize, boolean allowMaskMismatch, boolean checkStartsWith) |
Modifier and Type | Method and Description |
---|---|
protected void |
decode(ChannelHandlerContext ctx, WebSocketFrame frame, java.util.List<java.lang.Object> out)
从一条消息解码到另一条消息。
|
void |
exceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause)
|
void |
handlerAdded(ChannelHandlerContext ctx)
子类可以忽略这个方法。
|
acceptInboundMessage, channelRead
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
ensureNotSharable, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerRemoved
public WebSocketServerProtocolHandler(java.lang.String websocketPath)
public WebSocketServerProtocolHandler(java.lang.String websocketPath, boolean checkStartsWith)
public WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols)
public WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols, boolean allowExtensions)
public WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols, boolean allowExtensions, int maxFrameSize)
public WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols, boolean allowExtensions, int maxFrameSize, boolean allowMaskMismatch)
public WebSocketServerProtocolHandler(java.lang.String websocketPath, java.lang.String subprotocols, boolean allowExtensions, int maxFrameSize, boolean allowMaskMismatch, boolean checkStartsWith)
public void handlerAdded(ChannelHandlerContext ctx)
ChannelHandlerAdapter
handlerAdded
在界面
ChannelHandler
handlerAdded
ChannelHandlerAdapter
protected void decode(ChannelHandlerContext ctx, WebSocketFrame frame, java.util.List<java.lang.Object> out) throws java.lang.Exception
MessageToMessageDecoder
ctx
- 这MessageToMessageDecoder
属于的ChannelHandlerContext
frame
- 解码到另一个的消息
out
- 应该添加解码消息的
List
java.lang.Exception
- 发生错误时抛出
public void exceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireExceptionCaught(Throwable)
转发至ChannelPipeline
中的下一个ChannelHandler
。
子类可以重写此方法来更改行为。
exceptionCaught
接口
ChannelHandler
exceptionCaught
在界面
ChannelInboundHandler
java.lang.Exception
Copyright © 2008–2018 The Netty Project. All rights reserved.