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

pack-priv abstract Class WebSocketProtocolHandler

extends MessageToMessageDecoder<WebSocketFrame>
implements ChannelOutboundHandler
Class Inheritance
All Implemented Interfaces
io.netty.channel.ChannelOutboundHandler, io.netty.channel.ChannelHandler
Known Direct Subclasses
io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler, io.netty.handler.codec.http.websocketx.WebSocketClientProtocolHandler
Imports
io.netty.channel.ChannelFuture, .ChannelFutureListener, .ChannelHandlerContext, .ChannelOutboundHandler, .ChannelPromise, io.netty.handler.codec.MessageToMessageDecoder, io.netty.util.ReferenceCountUtil, io.netty.util.concurrent.Future, .PromiseNotifier, java.net.SocketAddress, java.nio.channels.ClosedChannelException, java.util.List, java.util.concurrent.TimeUnit

Field Summary

Modifier and TypeField and Description
private ChannelPromise
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
public void
bind(ChannelHandlerContext
the ChannelHandlerContext for which the bind operation is made
ctx
,
SocketAddress
the SocketAddress to which it should bound
localAddress
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.bind.

Called once a bind operation is made.
protected WebSocketHandshakeException
buildHandshakeException(String message)

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

public void
close(final ChannelHandlerContext
the ChannelHandlerContext for which the close operation is made
ctx
,
final ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.close.

Called once a close operation is made.
pack-priv void
public void
connect(ChannelHandlerContext
the ChannelHandlerContext for which the connect operation is made
ctx
,
SocketAddress
the SocketAddress to which it should connect
remoteAddress
,
SocketAddress
the SocketAddress which is used as source on connect
localAddress
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.connect.

Called once a connect operation is made.
protected void
decode(ChannelHandlerContext ctx, WebSocketFrame
the message to decode to an other one
frame
,
List<Object>
the List to which decoded messages should be added
out
)

Implements abstract io.netty.handler.codec.MessageToMessageDecoder.decode.

Decode from one message to an other.
public void
deregister(ChannelHandlerContext
the ChannelHandlerContext for which the close operation is made
ctx
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.deregister.

Called once a deregister operation is made from the current registered EventLoop.
public void
disconnect(ChannelHandlerContext
the ChannelHandlerContext for which the disconnect operation is made
ctx
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.disconnect.

Called once a disconnect operation is made.
public void
public void
flush(ChannelHandlerContext
the ChannelHandlerContext for which the flush operation is made
ctx
)

Implements io.netty.channel.ChannelOutboundHandler.flush.

Called once a flush operation is made.
public void
private static void
public void
write(final ChannelHandlerContext
the ChannelHandlerContext for which the write operation is made
ctx
,
Object
the message to write
msg
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Implements io.netty.channel.ChannelOutboundHandler.write.

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

Field Detail

closeSentback to summary
private ChannelPromise 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)
bindback to summary
public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.bind.

Doc from io.netty.channel.ChannelOutboundHandler.bind.

Called once a bind operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the bind operation is made

localAddress:SocketAddress

the SocketAddress to which it should bound

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
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.

closeback to summary
public void close(final ChannelHandlerContext ctx, final ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.close.

Doc from io.netty.channel.ChannelOutboundHandler.close.

Called once a close operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the close operation is made

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
closeSentback to summary
pack-priv void closeSent(ChannelPromise promise)
connectback to summary
public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.connect.

Doc from io.netty.channel.ChannelOutboundHandler.connect.

Called once a connect operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the connect operation is made

remoteAddress:SocketAddress

the SocketAddress to which it should connect

localAddress:SocketAddress

the SocketAddress which is used as source on connect

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
decodeback to summary
protected void decode(ChannelHandlerContext ctx, WebSocketFrame frame, List<Object> out) throws Exception

Implements abstract io.netty.handler.codec.MessageToMessageDecoder.decode.

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

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

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToMessageDecoder belongs to

frame:WebSocketFrame

the message to decode to an other one

out:List<Object>

the List to which decoded messages should be added

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
deregisterback to summary
public void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.deregister.

Doc from io.netty.channel.ChannelOutboundHandler.deregister.

Called once a deregister operation is made from the current registered EventLoop.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the close operation is made

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
disconnectback to summary
public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.disconnect.

Doc from io.netty.channel.ChannelOutboundHandler.disconnect.

Called once a disconnect operation is made.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the disconnect operation is made

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
exceptionCaughtback to summary
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception

Overrides io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught.

Implements io.netty.channel.ChannelHandler.exceptionCaught, io.netty.channel.ChannelInboundHandler.exceptionCaught.

Doc from io.netty.channel.ChannelHandler.exceptionCaught.

Gets called if a Throwable was thrown.

Annotations
@Override
flushback to summary
public void flush(ChannelHandlerContext ctx) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.flush.

Doc from io.netty.channel.ChannelOutboundHandler.flush.

Called once a flush operation is made. The flush operation will try to flush out all previous written messages that are pending.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext for which the flush operation is made

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs
readback to summary
public void read(ChannelHandlerContext ctx) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.read.

Doc from io.netty.channel.ChannelOutboundHandler.read.

Intercepts ChannelHandlerContext#read().

Annotations
@Override
readIfNeededback to summary
private static void readIfNeeded(ChannelHandlerContext ctx)
writeback to summary
public void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception

Implements io.netty.channel.ChannelOutboundHandler.write.

Doc from io.netty.channel.ChannelOutboundHandler.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

promise:ChannelPromise

the ChannelPromise to notify once the operation completes

Annotations
@Override
Exceptions
Exception:
thrown if an error occurs