Top Fields Constructors Methods
io.netty5.handler.codec.http.websocketx

pack-priv abstract Class WebSocketProtocolHandler

extends MessageToMessageDecoder<WebSocketFrame>
Class Inheritance
Known Direct Subclasses
io.netty5.handler.codec.http.websocketx.WebSocketServerProtocolHandler, io.netty5.handler.codec.http.websocketx.WebSocketClientProtocolHandler
Imports
io.netty5.channel.ChannelHandlerContext, .ChannelOption, io.netty5.handler.codec.MessageToMessageDecoder, io.netty5.util.Resource, io.netty5.util.concurrent.Future, .Promise, java.nio.channels.ClosedChannelException, java.util.concurrent.TimeUnit

Field Summary

Modifier and TypeField and Description
private Promise<Void>
private final WebSocketCloseStatus
private final boolean
private final long

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
WebSocketProtocolHandler(boolean
true if PongWebSocketFrames should be dropped
dropPongFrames
)

Creates a new WebSocketProtocolHandler, given a parameter that determines whether or not to drop PongWebSocketFrames.

pack-priv
WebSocketProtocolHandler(boolean dropPongFrames, WebSocketCloseStatus closeStatus, long forceCloseTimeoutMillis)

Method Summary

Modifier and TypeMethod and Description
private void
protected WebSocketHandshakeException
buildHandshakeException(String message)

Returns a WebSocketHandshakeException that depends on which client or server pipeline this handler belongs.

public void
channelExceptionCaught(ChannelHandlerContext ctx, Throwable cause)

Overrides default io.netty5.channel.ChannelHandler.channelExceptionCaught.

Gets called if a Throwable was thrown when handling inbound events.
public Future<Void>
close(final ChannelHandlerContext
the ChannelHandlerContext for which the close operation is made
ctx
)

Overrides default io.netty5.channel.ChannelHandler.close.

Called once a close operation is made.
pack-priv void
protected void
decode(ChannelHandlerContext ctx, WebSocketFrame
the message to decode to another one
msg
)

Overrides io.netty5.handler.codec.MessageToMessageDecoder.decode.

Decode from one message to another.
protected void
decodeAndClose(ChannelHandlerContext ctx, WebSocketFrame
the message to decode to another one
frame
)

Overrides io.netty5.handler.codec.MessageToMessageDecoder.decodeAndClose.

Decode from one message to another.
private static void
public Future<Void>
write(final ChannelHandlerContext
the ChannelHandlerContext for which the write operation is made
ctx
,
Object
the message to write
msg
)

Overrides default io.netty5.channel.ChannelHandler.write.

Called once a write operation is made.
Inherited from io.netty5.handler.codec.MessageToMessageDecoder:
acceptInboundMessagechannelRead

Field Detail

closeSentback to summary
private Promise<Void> closeSent
closeStatusback to summary
private final WebSocketCloseStatus closeStatus
dropPongFramesback to summary
private final boolean dropPongFrames
forceCloseTimeoutMillisback to summary
private final long forceCloseTimeoutMillis

Constructor Detail

WebSocketProtocolHandlerback to summary
pack-priv WebSocketProtocolHandler()

Creates a new WebSocketProtocolHandler that will drop PongWebSocketFrames.

WebSocketProtocolHandlerback to summary
pack-priv WebSocketProtocolHandler(boolean dropPongFrames)

Creates a new WebSocketProtocolHandler, given a parameter that determines whether or not to drop PongWebSocketFrames.

Parameters
dropPongFrames:boolean

true if PongWebSocketFrames should be dropped

WebSocketProtocolHandlerback to summary
pack-priv WebSocketProtocolHandler(boolean dropPongFrames, WebSocketCloseStatus closeStatus, long forceCloseTimeoutMillis)

Method Detail

applyCloseSentTimeoutback to summary
private void applyCloseSentTimeout(ChannelHandlerContext ctx)
buildHandshakeExceptionback to summary
protected WebSocketHandshakeException buildHandshakeException(String message)

Returns a WebSocketHandshakeException that depends on which client or server pipeline this handler belongs. Should be overridden in implementation otherwise a default exception is used.

channelExceptionCaughtback to summary
public void channelExceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception

Overrides default io.netty5.channel.ChannelHandler.channelExceptionCaught.

Doc from io.netty5.channel.ChannelHandler.channelExceptionCaught.

Gets called if a Throwable was thrown when handling inbound events.

Annotations
@Override
closeback to summary
public Future<Void> close(final ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.close.

Doc from io.netty5.channel.ChannelHandler.close.

Called once a close operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the close operation is made

Returns:Future<Void>

the Future which will be notified once the operation completes.

Annotations
@Override
closeSentback to summary
pack-priv void closeSent(Promise<Void> promise)
decodeback to summary
protected void decode(ChannelHandlerContext ctx, WebSocketFrame msg) throws Exception

Overrides io.netty5.handler.codec.MessageToMessageDecoder.decode.

Doc from io.netty5.handler.codec.MessageToMessageDecoder.decode.

Decode from one message to another. This method will be called for each written message that can be handled by this decoder.

The message will be disposed of after this call.

Subclasses that wish to sometimes pass messages through, should instead override the decodeAndClose(ChannelHandlerContext, Object) method.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToMessageDecoder belongs to

msg:WebSocketFrame

the message to decode to another one

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
decodeAndCloseback to summary
protected void decodeAndClose(ChannelHandlerContext ctx, WebSocketFrame frame) throws Exception

Overrides io.netty5.handler.codec.MessageToMessageDecoder.decodeAndClose.

Doc from io.netty5.handler.codec.MessageToMessageDecoder.decodeAndClose.

Decode from one message to another. This method will be called for each written message that can be handled by this decoder.

The message will not be automatically disposed of after this call. Instead, the responsibility of ensuring that messages are disposed of falls upon the implementor of this method.

Subclasses that wish to have incoming messages automatically disposed of should instead override the decodeAndClose(ChannelHandlerContext, Object) method.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToMessageDecoder belongs to

frame:WebSocketFrame

the message to decode to another one

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
readIfNeededback to summary
private static void readIfNeeded(ChannelHandlerContext ctx)
writeback to summary
public Future<Void> write(final ChannelHandlerContext ctx, Object msg)

Overrides default io.netty5.channel.ChannelHandler.write.

Doc from io.netty5.channel.ChannelHandler.write.

Called once a write operation is made. The write operation will write the messages through the ChannelPipeline. Those are then ready to be flushed to the actual Channel once Channel#flush() is called.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the write operation is made

msg:Object

the message to write

Returns:Future<Void>

the Future which will be notified once the operation completes.

Annotations
@Override