Class WebSocketClientHandshaker07
- java.lang.Object
-
- org.jboss.netty.handler.codec.http.websocketx.WebSocketClientHandshaker
-
- org.jboss.netty.handler.codec.http.websocketx.WebSocketClientHandshaker07
-
public class WebSocketClientHandshaker07 extends WebSocketClientHandshaker
Performs client side opening and closing handshakes for web socket specification version draft-ietf-hybi-thewebsocketprotocol- 07
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
allowExtensions
private java.lang.String
expectedChallengeResponseString
private static InternalLogger
logger
static java.lang.String
MAGIC_GUID
-
Fields inherited from class org.jboss.netty.handler.codec.http.websocketx.WebSocketClientHandshaker
customHeaders
-
-
Constructor Summary
Constructors Constructor Description WebSocketClientHandshaker07(java.net.URI webSocketURL, WebSocketVersion version, java.lang.String subprotocol, boolean allowExtensions, java.util.Map<java.lang.String,java.lang.String> customHeaders, long maxFramePayloadLength)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finishHandshake(Channel channel, HttpResponse response)
Process server response:ChannelFuture
handshake(Channel channel)
/**-
Methods inherited from class org.jboss.netty.handler.codec.http.websocketx.WebSocketClientHandshaker
getActualSubprotocol, getExpectedSubprotocol, getMaxFramePayloadLength, getVersion, getWebSocketUrl, isHandshakeComplete, replaceDecoder, setActualSubprotocol, setHandshakeComplete
-
-
-
-
Field Detail
-
logger
private static final InternalLogger logger
-
MAGIC_GUID
public static final java.lang.String MAGIC_GUID
- See Also:
- Constant Field Values
-
expectedChallengeResponseString
private java.lang.String expectedChallengeResponseString
-
allowExtensions
private final boolean allowExtensions
-
-
Constructor Detail
-
WebSocketClientHandshaker07
public WebSocketClientHandshaker07(java.net.URI webSocketURL, WebSocketVersion version, java.lang.String subprotocol, boolean allowExtensions, java.util.Map<java.lang.String,java.lang.String> customHeaders, long 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 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 payload
-
-
Method Detail
-
handshake
public 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: 7
- Specified by:
handshake
in classWebSocketClientHandshaker
- Parameters:
channel
- Channel into which we can write our request
-
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 classWebSocketClientHandshaker
- Parameters:
channel
- Channelresponse
- HTTP response returned from the server for the request sent by beginOpeningHandshake00().- Throws:
WebSocketHandshakeException
-
-