public class WebSocketClientHandshaker07 extends WebSocketClientHandshaker
Performs client side opening and closing handshakes for web socket specification version draft-ietf-hybi-thewebsocketprotocol- 10
| Modifier and Type | Field and Description |
|---|---|
private boolean |
allowExtensions |
private boolean |
allowMaskMismatch |
private java.lang.String |
expectedChallengeResponseString |
private static InternalLogger |
logger |
static java.lang.String |
MAGIC_GUID |
private boolean |
performMasking |
customHeaders| Constructor and Description |
|---|
WebSocketClientHandshaker07(java.net.URI webSocketURL,
WebSocketVersion version,
java.lang.String subprotocol,
boolean allowExtensions,
HttpHeaders customHeaders,
int maxFramePayloadLength)
Creates a new instance.
|
WebSocketClientHandshaker07(java.net.URI webSocketURL,
WebSocketVersion version,
java.lang.String subprotocol,
boolean allowExtensions,
HttpHeaders customHeaders,
int maxFramePayloadLength,
boolean performMasking,
boolean allowMaskMismatch)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected FullHttpRequest |
newHandshakeRequest()
/**
|
protected WebSocketFrameDecoder |
newWebsocketDecoder()
Returns the decoder to use after handshake is complete.
|
protected WebSocketFrameEncoder |
newWebSocketEncoder()
Returns the encoder to use after the handshake is complete.
|
protected void |
verify(FullHttpResponse response)
Process server response:
|
actualSubprotocol, close, close, expectedSubprotocol, finishHandshake, handshake, handshake, isHandshakeComplete, maxFramePayloadLength, processHandshake, processHandshake, rawPath, uri, version, websocketHostValue, websocketOriginValue, websocketPortprivate static final InternalLogger logger
public static final java.lang.String MAGIC_GUID
private java.lang.String expectedChallengeResponseString
private final boolean allowExtensions
private final boolean performMasking
private final boolean allowMaskMismatch
public WebSocketClientHandshaker07(java.net.URI webSocketURL,
WebSocketVersion version,
java.lang.String subprotocol,
boolean allowExtensions,
HttpHeaders customHeaders,
int maxFramePayloadLength)
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 serversubprotocol - Sub protocol request sent to the server.allowExtensions - Allow extensions to be used in the reserved bits of the web socket framecustomHeaders - Map of custom headers to add to the client requestmaxFramePayloadLength - Maximum length of a frame's payloadpublic WebSocketClientHandshaker07(java.net.URI webSocketURL,
WebSocketVersion version,
java.lang.String subprotocol,
boolean allowExtensions,
HttpHeaders customHeaders,
int maxFramePayloadLength,
boolean performMasking,
boolean allowMaskMismatch)
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 serversubprotocol - Sub protocol request sent to the server.allowExtensions - Allow extensions to be used in the reserved bits of the web socket framecustomHeaders - Map of custom headers to add to the client requestmaxFramePayloadLength - Maximum length of a frame's payloadperformMasking - 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.protected 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-Origin: http://example.com Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 7
newHandshakeRequest in class WebSocketClientHandshakerprotected 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
verify in class WebSocketClientHandshakerresponse - HTTP response returned from the server for the request sent by beginOpeningHandshake00().WebSocketHandshakeExceptionprotected WebSocketFrameDecoder newWebsocketDecoder()
WebSocketClientHandshakernewWebsocketDecoder in class WebSocketClientHandshakerprotected WebSocketFrameEncoder newWebSocketEncoder()
WebSocketClientHandshakernewWebSocketEncoder in class WebSocketClientHandshaker