Class WebSocketClientHandshaker13
- java.lang.Object
- 
- io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker
- 
- io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13
 
 
- 
 public class WebSocketClientHandshaker13 extends WebSocketClientHandshaker Performs client side opening and closing handshakes for web socket specification version draft-ietf-hybi-thewebsocketprotocol- 17 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringMAGIC_GUID- 
Fields inherited from class io.netty.handler.codec.http.websocketx.WebSocketClientHandshakercustomHeaders, DEFAULT_FORCE_CLOSE_TIMEOUT_MILLIS, generateOriginHeader
 
- 
 - 
Constructor SummaryConstructors Constructor Description WebSocketClientHandshaker13(java.net.URI webSocketURL, WebSocketVersion version, java.lang.String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength)Creates a new instance.WebSocketClientHandshaker13(java.net.URI webSocketURL, WebSocketVersion version, java.lang.String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch)Creates a new instance.WebSocketClientHandshaker13(java.net.URI webSocketURL, WebSocketVersion version, java.lang.String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis)Creates a new instance.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisAllowExtensions()booleanisAllowMaskMismatch()booleanisPerformMasking()protected FullHttpRequestnewHandshakeRequest()/**protected WebSocketFrameDecodernewWebsocketDecoder()Returns the decoder to use after handshake is complete.protected WebSocketFrameEncodernewWebSocketEncoder()Returns the encoder to use after the handshake is complete.WebSocketClientHandshaker13setForceCloseTimeoutMillis(long forceCloseTimeoutMillis)Sets timeout to close the connection if it was not closed by the server.protected voidverify(FullHttpResponse response)Process server response:- 
Methods inherited from class io.netty.handler.codec.http.websocketx.WebSocketClientHandshakeractualSubprotocol, close, close, close, close, expectedSubprotocol, finishHandshake, forceCloseTimeoutMillis, handshake, handshake, isForceCloseComplete, isHandshakeComplete, maxFramePayloadLength, processHandshake, processHandshake, upgradeUrl, uri, version
 
- 
 
- 
- 
- 
Field Detail- 
MAGIC_GUIDpublic static final java.lang.String MAGIC_GUID - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
WebSocketClientHandshaker13public WebSocketClientHandshaker13(java.net.URI webSocketURL, WebSocketVersion version, java.lang.String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength)Creates a new instance.- Parameters:
- webSocketURL- URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
- version- Version of web socket specification to use to connect to the server
- subprotocol- Sub protocol request sent to the server.
- allowExtensions- Allow extensions to be used in the reserved bits of the web socket frame
- customHeaders- Map of custom headers to add to the client request
- maxFramePayloadLength- Maximum length of a frame's payload
 
 - 
WebSocketClientHandshaker13public WebSocketClientHandshaker13(java.net.URI webSocketURL, WebSocketVersion version, java.lang.String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch)Creates a new instance.- Parameters:
- webSocketURL- URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
- version- Version of web socket specification to use to connect to the server
- subprotocol- Sub protocol request sent to the server.
- allowExtensions- Allow extensions to be used in the reserved bits of the web socket frame
- customHeaders- Map of custom headers to add to the client request
- maxFramePayloadLength- Maximum length of a frame's payload
- performMasking- Whether 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.
- allowMaskMismatch- When set to true, frames which are not masked properly according to the standard will still be accepted.
 
 - 
WebSocketClientHandshaker13public WebSocketClientHandshaker13(java.net.URI webSocketURL, WebSocketVersion version, java.lang.String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis)Creates a new instance.- Parameters:
- webSocketURL- URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
- version- Version of web socket specification to use to connect to the server
- subprotocol- Sub protocol request sent to the server.
- allowExtensions- Allow extensions to be used in the reserved bits of the web socket frame
- customHeaders- Map of custom headers to add to the client request
- maxFramePayloadLength- Maximum length of a frame's payload
- performMasking- Whether 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.
- allowMaskMismatch- When set to true, frames which are not masked properly according to the standard will still be accepted
- forceCloseTimeoutMillis- Close the connection if it was not closed by the server after timeout specified.
 
 
- 
 - 
Method Detail- 
newHandshakeRequestprotected FullHttpRequest newHandshakeRequest() /**Sends the opening request to the server: GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 13 - Specified by:
- newHandshakeRequestin class- WebSocketClientHandshaker
 
 - 
verifyprotected void verify(FullHttpResponse response) Process server response: HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Protocol: chat - Specified by:
- verifyin class- WebSocketClientHandshaker
- Parameters:
- response- HTTP response returned from the server for the request sent by beginOpeningHandshake00().
- Throws:
- WebSocketHandshakeException- if handshake response is invalid.
 
 - 
newWebsocketDecoderprotected WebSocketFrameDecoder newWebsocketDecoder() Description copied from class:WebSocketClientHandshakerReturns the decoder to use after handshake is complete.- Specified by:
- newWebsocketDecoderin class- WebSocketClientHandshaker
 
 - 
newWebSocketEncoderprotected WebSocketFrameEncoder newWebSocketEncoder() Description copied from class:WebSocketClientHandshakerReturns the encoder to use after the handshake is complete.- Specified by:
- newWebSocketEncoderin class- WebSocketClientHandshaker
 
 - 
setForceCloseTimeoutMillispublic WebSocketClientHandshaker13 setForceCloseTimeoutMillis(long forceCloseTimeoutMillis) Description copied from class:WebSocketClientHandshakerSets timeout to close the connection if it was not closed by the server.- Overrides:
- setForceCloseTimeoutMillisin class- WebSocketClientHandshaker
- Parameters:
- forceCloseTimeoutMillis- Close the connection if it was not closed by the server after timeout specified
 
 - 
isAllowExtensionspublic boolean isAllowExtensions() 
 - 
isPerformMaskingpublic boolean isPerformMasking() 
 - 
isAllowMaskMismatchpublic boolean isAllowMaskMismatch() 
 
- 
 
-