org.jboss.netty.handler.codec.http.websocketx

## Class WebSocketClientHandshaker08

- java.lang.Object
- - org.jboss.netty.handler.codec.http.websocketx.WebSocketClientHandshaker
  - - org.jboss.netty.handler.codec.http.websocketx.WebSocketClientHandshaker08

    public class WebSocketClientHandshaker08
    extends WebSocketClientHandshaker

Performs client side opening and closing handshakes for web socket specification version draft-ietf-hybi-thewebsocketprotocol- 10

### Field Summary

Fields
`static String` `MAGIC_GUID`

### Fields inherited from class org.jboss.netty.handler.codec.http.websocketx.WebSocketClientHandshaker

`customHeaders`

### Constructor Summary

Constructors
Constructor and Description
`WebSocketClientHandshaker08(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, Map<String,String> customHeaders)` Constructor with default values
`WebSocketClientHandshaker08(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, Map<String,String> customHeaders, long maxFramePayloadLength)` Constructor

### Method Summary

Methods
`void` `finishHandshake(Channel channel, HttpResponse response)` Process server response: HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Protocol: chat
`ChannelFuture` `handshake(Channel channel)` /** 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: 8

### Methods inherited from class org.jboss.netty.handler.codec.http.websocketx.WebSocketClientHandshaker

`getActualSubprotocol, getExpectedSubprotocol, getMaxFramePayloadLength, getVersion, getWebSocketUrl, isHandshakeComplete, setActualSubprotocol, setHandshakeComplete`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### MAGIC_GUID

    public static final String MAGIC_GUID

See Also:
  Constant Field Values

### Constructor Detail

#### WebSocketClientHandshaker08

    public WebSocketClientHandshaker08(URI webSocketURL,
                               WebSocketVersion version,
                               String subprotocol,
                               boolean allowExtensions,
                               Map<String,String> customHeaders)

Constructor with default values

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

#### WebSocketClientHandshaker08

    public WebSocketClientHandshaker08(URI webSocketURL,
                               WebSocketVersion version,
                               String subprotocol,
                               boolean allowExtensions,
                               Map<String,String> customHeaders,
                               long maxFramePayloadLength)

Constructor

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

### Method Detail

#### handshake

    public ChannelFuture handshake(Channel channel)
                            throws Exception

/**

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: 8

Specified by:
  `handshake` in class `WebSocketClientHandshaker`
Parameters:
  `channel` - Channel into which we can write our request
Throws:
  `Exception`

#### finishHandshake

    public void finishHandshake(Channel channel,
                       HttpResponse 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:
  `finishHandshake` in class `WebSocketClientHandshaker`
Parameters:
  `channel` - Channel
  `response` - HTTP response returned from the server for the request sent by beginOpeningHandshake00().
Throws:
  `WebSocketHandshakeException`