public abstract class WebSocketClientHandshaker extends Object
| Modifier and Type | Field and Description | 
|---|---|
protected HttpHeaders | 
customHeaders  | 
| Modifier | Constructor and Description | 
|---|---|
protected  | 
WebSocketClientHandshaker(URI uri,
                         WebSocketVersion version,
                         String subprotocol,
                         HttpHeaders customHeaders,
                         int maxFramePayloadLength)
Base constructor 
 | 
| Modifier and Type | Method and Description | 
|---|---|
String | 
actualSubprotocol()
Returns the subprotocol response sent by the server. 
 | 
io.netty.channel.ChannelFuture | 
close(io.netty.channel.Channel channel,
     CloseWebSocketFrame frame)
Performs the closing handshake 
 | 
io.netty.channel.ChannelFuture | 
close(io.netty.channel.Channel channel,
     CloseWebSocketFrame frame,
     io.netty.channel.ChannelPromise promise)
Performs the closing handshake 
 | 
String | 
expectedSubprotocol()
Returns the CSV of requested subprotocol(s) sent to the server as specified in the constructor 
 | 
void | 
finishHandshake(io.netty.channel.Channel channel,
               FullHttpResponse response)
Validates and finishes the opening handshake initiated by  
handshake(io.netty.channel.Channel)}. | 
io.netty.channel.ChannelFuture | 
handshake(io.netty.channel.Channel channel)
Begins the opening handshake 
 | 
io.netty.channel.ChannelFuture | 
handshake(io.netty.channel.Channel channel,
         io.netty.channel.ChannelPromise promise)
Begins the opening handshake 
 | 
boolean | 
isHandshakeComplete()
Flag to indicate if the opening handshake is complete 
 | 
int | 
maxFramePayloadLength()
Returns the max length for any frame's payload 
 | 
protected abstract FullHttpRequest | 
newHandshakeRequest()
Returns a new {@link FullHttpRequest) which will be used for the handshake. 
 | 
protected abstract WebSocketFrameDecoder | 
newWebsocketDecoder()
Returns the decoder to use after handshake is complete. 
 | 
protected abstract WebSocketFrameEncoder | 
newWebSocketEncoder()
Returns the encoder to use after the handshake is complete. 
 | 
io.netty.channel.ChannelFuture | 
processHandshake(io.netty.channel.Channel channel,
                HttpResponse response)
Process the opening handshake initiated by  
handshake(io.netty.channel.Channel)}. | 
io.netty.channel.ChannelFuture | 
processHandshake(io.netty.channel.Channel channel,
                HttpResponse response,
                io.netty.channel.ChannelPromise promise)
Process the opening handshake initiated by  
handshake(io.netty.channel.Channel)}. | 
URI | 
uri()
Returns the URI to the web socket. e.g. 
 | 
protected abstract void | 
verify(FullHttpResponse response)
Verfiy the  
FullHttpResponse and throws a WebSocketHandshakeException if something is wrong. | 
WebSocketVersion | 
version()
Version of the web socket specification that is being used 
 | 
protected final HttpHeaders customHeaders
protected WebSocketClientHandshaker(URI uri, WebSocketVersion version, String subprotocol, HttpHeaders customHeaders, int maxFramePayloadLength)
uri - 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.customHeaders - Map of custom headers to add to the client requestmaxFramePayloadLength - Maximum length of a frame's payloadpublic URI uri()
public WebSocketVersion version()
public int maxFramePayloadLength()
public boolean isHandshakeComplete()
public String expectedSubprotocol()
public String actualSubprotocol()
public io.netty.channel.ChannelFuture handshake(io.netty.channel.Channel channel)
channel - Channelpublic final io.netty.channel.ChannelFuture handshake(io.netty.channel.Channel channel,
                                       io.netty.channel.ChannelPromise promise)
channel - Channelpromise - the ChannelPromise to be notified when the opening handshake is sentprotected abstract FullHttpRequest newHandshakeRequest()
public final void finishHandshake(io.netty.channel.Channel channel,
                   FullHttpResponse response)
handshake(io.netty.channel.Channel)}.channel - Channelresponse - HTTP response containing the closing handshake detailspublic final io.netty.channel.ChannelFuture processHandshake(io.netty.channel.Channel channel,
                                              HttpResponse response)
handshake(io.netty.channel.Channel)}.channel - Channelresponse - HTTP response containing the closing handshake detailsChannelFuture which is notified once the handshake completes.public final io.netty.channel.ChannelFuture processHandshake(io.netty.channel.Channel channel,
                                              HttpResponse response,
                                              io.netty.channel.ChannelPromise promise)
handshake(io.netty.channel.Channel)}.channel - Channelresponse - HTTP response containing the closing handshake detailspromise - the ChannelPromise to notify once the handshake completes.ChannelFuture which is notified once the handshake completes.protected abstract void verify(FullHttpResponse response)
FullHttpResponse and throws a WebSocketHandshakeException if something is wrong.protected abstract WebSocketFrameDecoder newWebsocketDecoder()
protected abstract WebSocketFrameEncoder newWebSocketEncoder()
public io.netty.channel.ChannelFuture close(io.netty.channel.Channel channel,
                                   CloseWebSocketFrame frame)
channel - Channelframe - Closing Frame that was receivedpublic io.netty.channel.ChannelFuture close(io.netty.channel.Channel channel,
                                   CloseWebSocketFrame frame,
                                   io.netty.channel.ChannelPromise promise)
channel - Channelframe - Closing Frame that was receivedpromise - the ChannelPromise to be notified when the closing handshake is doneCopyright © 2008–2017 The Netty Project. All rights reserved.