Performs client side opening and closing handshakes for web socket specification version websocketprotocol-v13
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final boolean | |
| private final boolean | |
| private volatile String |
| Access | Constructor and Description |
|---|---|
| public | WebSocketClientHandshaker13(URI
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
sent to this URL. webSocketURL, String Sub protocol request sent to the server. subprotocol, boolean Allow extensions to be used in the reserved bits of the web socket frame allowExtensions, HttpHeaders Map of custom headers to add to the client request customHeaders, int Maximum length of a frame's payload maxFramePayloadLength)Creates a new instance. |
| public | WebSocketClientHandshaker13(URI
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
sent to this URL. webSocketURL, String Sub protocol request sent to the server. subprotocol, boolean Allow extensions to be used in the reserved bits of the web socket frame allowExtensions, HttpHeaders Map of custom headers to add to the client request customHeaders, int Maximum length of a frame's payload maxFramePayloadLength, boolean 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. performMasking, boolean When set to true, frames which are not masked properly according to the standard will still be
accepted. allowMaskMismatch)Creates a new instance. |
| public | WebSocketClientHandshaker13(URI
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
sent to this URL. webSocketURL, String Sub protocol request sent to the server. subprotocol, boolean Allow extensions to be used in the reserved bits of the web socket frame allowExtensions, HttpHeaders Map of custom headers to add to the client request customHeaders, int Maximum length of a frame's payload maxFramePayloadLength, boolean 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. performMasking, boolean When set to true, frames which are not masked properly according to the standard will still be
accepted allowMaskMismatch, long Close the connection if it was not closed by the server after timeout specified. forceCloseTimeoutMillis)Creates a new instance. |
| pack-priv | WebSocketClientHandshaker13(URI
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
sent to this URL. webSocketURL, String Sub protocol request sent to the server. subprotocol, boolean Allow extensions to be used in the reserved bits of the web socket frame allowExtensions, HttpHeaders Map of custom headers to add to the client request customHeaders, int Maximum length of a frame's payload maxFramePayloadLength, boolean 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. performMasking, boolean When set to true, frames which are not masked properly according to the standard will still be
accepted allowMaskMismatch, long Close the connection if it was not closed by the server after timeout specified. forceCloseTimeoutMillis, boolean Use an absolute url for the Upgrade request, typically when connecting through an HTTP proxy over
clear HTTP absoluteUpgradeUrl)Creates a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| private static String | createNonce()
Creates a nonce consisting of a randomly selected 16-byte value that has been base64-encoded. |
| protected FullHttpRequest | newHandshakeRequest(BufferAllocator allocator)
Implements abstract io. 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 |
| protected WebSocketFrameDecoder | newWebsocketDecoder()
Implements abstract io. |
| protected WebSocketFrameEncoder | newWebSocketEncoder()
Implements abstract io. |
| public WebSocketClientHandshaker13 | setForceCloseTimeoutMillis(long
Close the connection if it was not closed by the server after timeout specified forceCloseTimeoutMillis)Overrides io. |
| protected void | verify(FullHttpResponse
HTTP response returned from the server for the request sent by beginOpeningHandshake00(). response)Implements abstract io. Process server response: HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Protocol: chat |
| allowExtensions | back to summary |
|---|---|
| private final boolean allowExtensions | |
| allowMaskMismatch | back to summary |
|---|---|
| private final boolean allowMaskMismatch | |
| performMasking | back to summary |
|---|---|
| private final boolean performMasking | |
| sentNonce | back to summary |
|---|---|
| private volatile String sentNonce | |
| WebSocketClientHandshaker13 | back to summary |
|---|---|
| public WebSocketClientHandshaker13(URI webSocketURL, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) Creates a new instance.
| |
| WebSocketClientHandshaker13 | back to summary |
|---|---|
| public WebSocketClientHandshaker13(URI webSocketURL, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch) Creates a new instance.
| |
| WebSocketClientHandshaker13 | back to summary |
|---|---|
| public WebSocketClientHandshaker13(URI webSocketURL, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis) Creates a new instance.
| |
| WebSocketClientHandshaker13 | back to summary |
|---|---|
| pack-priv WebSocketClientHandshaker13(URI webSocketURL, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl) Creates a new instance.
| |
| createNonce | back to summary |
|---|---|
| private static String createNonce() Creates a nonce consisting of a randomly selected 16-byte value that has been base64-encoded. | |
| newHandshakeRequest | back to summary |
|---|---|
| protected FullHttpRequest newHandshakeRequest(BufferAllocator allocator) Implements abstract io. /** 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
| |
| newWebsocketDecoder | back to summary |
|---|---|
| protected WebSocketFrameDecoder newWebsocketDecoder() Implements abstract io. Doc from io. Returns the decoder to use after handshake is complete.
| |
| newWebSocketEncoder | back to summary |
|---|---|
| protected WebSocketFrameEncoder newWebSocketEncoder() Implements abstract io. Doc from io. Returns the encoder to use after the handshake is complete.
| |
| setForceCloseTimeoutMillis | back to summary |
|---|---|
| public WebSocketClientHandshaker13 setForceCloseTimeoutMillis(long forceCloseTimeoutMillis) Overrides io. Doc from io. Sets timeout to close the connection if it was not closed by the server.
| |
| verify | back to summary |
|---|---|
| protected void verify(FullHttpResponse response) Implements abstract io. Process server response: HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Protocol: chat
| |