handleCloseFrames is false, default is true.
This implementation will establish the websocket connection once the connection to the remote server was complete.
To know once a handshake was done you can intercept the
ChannelInboundHandler#userEventTriggered(ChannelHandlerContext, Object) and check if the event was of type
ClientHandshakeStateEvent#HANDSHAKE_ISSUED or ClientHandshakeStateEvent#HANDSHAKE_COMPLETE.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | WebSocketClientProtocolHandler.
Events that are fired to notify about handshake status |
| Modifier and Type | Field and Description |
|---|---|
| private final WebSocketClientProtocolConfig | |
| private final WebSocketClientHandshaker |
| Access | Constructor and Description |
|---|---|
| public | WebSocketClientProtocolHandler(WebSocketClientProtocolConfig
Client protocol configuration. clientConfig)Base constructor |
| public | WebSocketClientProtocolHandler(WebSocketClientHandshaker
The handshaker, WebSocketClientProtocolConfig WebSocketClientHandshaker which will be used to issue the handshake once the connection
was established to the remote peer.Client protocol configuration. clientConfig)Base constructor |
| public | WebSocketClientProtocolHandler(URI
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
sent to this URL. webSocketURL, WebSocketVersion Version of web socket specification to use to connect to the server version, String Sub protocol request sent to the server. subprotocol, boolean allowExtensions, HttpHeaders Map of custom headers to add to the client request customHeaders, int Maximum length of a frame's payload maxFramePayloadLength, boolean true if close frames should not be forwarded and just close the channelWhether to mask all written websocket frames. This must be set to true in order to be fully compatible
with the websocket specifications. Client applications that communicate with a non-standard server
which doesn't require masking might set this to false to achieve a higher performance. performMasking, boolean When set to true, frames which are not masked properly according to the standard will still be
accepted. allowMaskMismatch)Base constructor |
| public | WebSocketClientProtocolHandler(URI
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
sent to this URL. webSocketURL, WebSocketVersion Version of web socket specification to use to connect to the server version, String Sub protocol request sent to the server. subprotocol, boolean allowExtensions, HttpHeaders Map of custom headers to add to the client request customHeaders, int Maximum length of a frame's payload maxFramePayloadLength, boolean true if close frames should not be forwarded and just close the channelWhether to mask all written websocket frames. This must be set to true in order to be fully compatible
with the websocket specifications. Client applications that communicate with a non-standard server
which doesn't require masking might set this to false to achieve a higher performance. performMasking, boolean When set to true, frames which are not masked properly according to the standard will still be
accepted. allowMaskMismatch, long Handshake timeout in mills, when handshake timeout, will trigger user
event handshakeTimeoutMillis)ClientHandshakeStateEvent#HANDSHAKE_TIMEOUTBase constructor |
| public | WebSocketClientProtocolHandler(URI
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
sent to this URL. webSocketURL, WebSocketVersion Version of web socket specification to use to connect to the server version, String Sub protocol request sent to the server. subprotocol, boolean allowExtensions, HttpHeaders Map of custom headers to add to the client request customHeaders, int Maximum length of a frame's payload maxFramePayloadLength, boolean true if close frames should not be forwarded and just close the channelBase constructor |
| public | WebSocketClientProtocolHandler(URI
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
sent to this URL. webSocketURL, WebSocketVersion Version of web socket specification to use to connect to the server version, String Sub protocol request sent to the server. subprotocol, boolean allowExtensions, HttpHeaders Map of custom headers to add to the client request customHeaders, int Maximum length of a frame's payload maxFramePayloadLength, boolean true if close frames should not be forwarded and just close the channelHandshake timeout in mills, when handshake timeout, will trigger user
event handshakeTimeoutMillis)ClientHandshakeStateEvent#HANDSHAKE_TIMEOUTBase constructor |
| public | WebSocketClientProtocolHandler(URI
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
sent to this URL. webSocketURL, WebSocketVersion Version of web socket specification to use to connect to the server version, String Sub protocol request sent to the server. subprotocol, boolean allowExtensions, HttpHeaders Map of custom headers to add to the client request customHeaders, int Maximum length of a frame's payload maxFramePayloadLength)Base constructor |
| public | WebSocketClientProtocolHandler(URI
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
sent to this URL. webSocketURL, WebSocketVersion Version of web socket specification to use to connect to the server version, String Sub protocol request sent to the server. subprotocol, boolean allowExtensions, HttpHeaders Map of custom headers to add to the client request customHeaders, int Maximum length of a frame's payload maxFramePayloadLength, long Handshake timeout in mills, when handshake timeout, will trigger user
event handshakeTimeoutMillis)ClientHandshakeStateEvent#HANDSHAKE_TIMEOUTBase constructor |
| public | WebSocketClientProtocolHandler(WebSocketClientHandshaker
The handshaker, boolean WebSocketClientHandshaker which will be used to issue the handshake once the connection
was established to the remote peer.true if close frames should not be forwarded and just close the channelBase constructor |
| public | WebSocketClientProtocolHandler(WebSocketClientHandshaker
The handshaker, boolean WebSocketClientHandshaker which will be used to issue the handshake once the connection
was established to the remote peer.true if close frames should not be forwarded and just close the channelHandshake timeout in mills, when handshake timeout, will trigger user
event handshakeTimeoutMillis)ClientHandshakeStateEvent#HANDSHAKE_TIMEOUTBase constructor |
| public | WebSocketClientProtocolHandler(WebSocketClientHandshaker
The handshaker, boolean WebSocketClientHandshaker which will be used to issue the handshake once the connection
was established to the remote peer.true if close frames should not be forwarded and just close the channeltrue if pong frames should not be forwardedBase constructor |
| public | WebSocketClientProtocolHandler(WebSocketClientHandshaker
The handshaker, boolean WebSocketClientHandshaker which will be used to issue the handshake once the connection
was established to the remote peer.true if close frames should not be forwarded and just close the channeltrue if pong frames should not be forwardedHandshake timeout in mills, when handshake timeout, will trigger user
event handshakeTimeoutMillis)ClientHandshakeStateEvent#HANDSHAKE_TIMEOUTBase constructor |
| public | WebSocketClientProtocolHandler(WebSocketClientHandshaker
The handshaker, boolean WebSocketClientHandshaker which will be used to issue the handshake once the connection
was established to the remote peer.true if close frames should not be forwarded and just close the channeltrue if pong frames should not be forwardedHandshake timeout in mills, when handshake timeout, will trigger user
event handshakeTimeoutMillis, boolean ClientHandshakeStateEvent#HANDSHAKE_TIMEOUTtrue if UTF8 validation of text frames should be enabledBase constructor |
| public | WebSocketClientProtocolHandler(WebSocketClientHandshaker
The handshaker)WebSocketClientHandshaker which will be used to issue the handshake once the connection
was established to the remote peer.Base constructor |
| public | WebSocketClientProtocolHandler(WebSocketClientHandshaker
The handshaker, long WebSocketClientHandshaker which will be used to issue the handshake once the connection
was established to the remote peer.Handshake timeout in mills, when handshake timeout, will trigger user
event handshakeTimeoutMillis)ClientHandshakeStateEvent#HANDSHAKE_TIMEOUTBase constructor |
| Modifier and Type | Method and Description |
|---|---|
| protected WebSocketClientHandshakeException | buildHandshakeException(String message)
Overrides io. WebSocketHandshakeException that depends on which client or server pipeline
this handler belongs.
|
| protected void | decode(ChannelHandlerContext
the ctx, WebSocketFrame ChannelHandlerContext which this MessageToMessageDecoder belongs tothe message to decode to an other one frame, List<Object> the out)List to which decoded messages should be addedOverrides io. |
| public void | handlerAdded(ChannelHandlerContext ctx)
Overrides io. Implements io. ChannelHandler was added to the actual context and it's ready to handle events.
|
| public WebSocketClientHandshaker |
| clientConfig | back to summary |
|---|---|
| private final WebSocketClientProtocolConfig clientConfig | |
| handshaker | back to summary |
|---|---|
| private final WebSocketClientHandshaker handshaker | |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(WebSocketClientProtocolConfig clientConfig) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker, WebSocketClientProtocolConfig clientConfig) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean handleCloseFrames, boolean performMasking, boolean allowMaskMismatch) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean handleCloseFrames, boolean performMasking, boolean allowMaskMismatch, long handshakeTimeoutMillis) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean handleCloseFrames) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean handleCloseFrames, long handshakeTimeoutMillis) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, long handshakeTimeoutMillis) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker, boolean handleCloseFrames) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker, boolean handleCloseFrames, long handshakeTimeoutMillis) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker, boolean handleCloseFrames, boolean dropPongFrames) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker, boolean handleCloseFrames, boolean dropPongFrames, long handshakeTimeoutMillis) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker, boolean handleCloseFrames, boolean dropPongFrames, long handshakeTimeoutMillis, boolean withUTF8Validator) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker) Base constructor
| |
| WebSocketClientProtocolHandler | back to summary |
|---|---|
| public WebSocketClientProtocolHandler(WebSocketClientHandshaker handshaker, long handshakeTimeoutMillis) Base constructor
| |
| buildHandshakeException | back to summary |
|---|---|
| protected WebSocketClientHandshakeException buildHandshakeException(String message) Overrides io. Doc from io. Returns a
| |
| decode | back to summary |
|---|---|
| protected void decode(ChannelHandlerContext ctx, WebSocketFrame frame, List<Object> out) throws Exception Overrides io. Doc from io. Decode from one message to an other. This method will be called for each written message that can be handled by this decoder.
| |
| handlerAdded | back to summary |
|---|---|
| public void handlerAdded(ChannelHandlerContext ctx) Overrides io. Implements io. Doc from io. Gets called after the
| |
| handshaker | back to summary |
|---|---|
| public WebSocketClientHandshaker handshaker() Returns the used handshaker | |
| Modifier and Type | Field and Description |
|---|---|
| public static final WebSocketClientProtocolHandler. | HANDSHAKE_COMPLETE
The Handshake was complete successful and so the channel was upgraded to websockets |
| public static final WebSocketClientProtocolHandler. | HANDSHAKE_ISSUED
The Handshake was started but the server did not response yet to the request |
| public static final WebSocketClientProtocolHandler. | HANDSHAKE_TIMEOUT
The Handshake was timed out |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static WebSocketClientProtocolHandler. | |
| public static WebSocketClientProtocolHandler. |
| HANDSHAKE_COMPLETE | back to summary |
|---|---|
| public static final WebSocketClientProtocolHandler. The Handshake was complete successful and so the channel was upgraded to websockets | |
| HANDSHAKE_ISSUED | back to summary |
|---|---|
| public static final WebSocketClientProtocolHandler. The Handshake was started but the server did not response yet to the request | |
| HANDSHAKE_TIMEOUT | back to summary |
|---|---|
| public static final WebSocketClientProtocolHandler. The Handshake was timed out | |
| ClientHandshakeStateEvent | back to summary |
|---|---|
| private ClientHandshakeStateEvent() | |
| valueOf | back to summary |
|---|---|
| public static WebSocketClientProtocolHandler. | |
| values | back to summary |
|---|---|
| public static WebSocketClientProtocolHandler. | |