public abstract class WebSocketServerHandshaker extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static io.netty.util.internal.logging.InternalLogger |
logger |
static String |
SUB_PROTOCOL_WILDCARD
Use this as wildcard to support all requested sub-protocols
|
| Modifier | Constructor and Description |
|---|---|
protected |
WebSocketServerHandshaker(WebSocketVersion version,
String uri,
String subprotocols,
int maxFramePayloadLength)
Constructor specifying the destination web socket location
|
| Modifier and Type | Method and Description |
|---|---|
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
|
io.netty.channel.ChannelFuture |
handshake(io.netty.channel.Channel channel,
FullHttpRequest req)
Performs the opening handshake
|
io.netty.channel.ChannelFuture |
handshake(io.netty.channel.Channel channel,
FullHttpRequest req,
HttpHeaders responseHeaders,
io.netty.channel.ChannelPromise promise)
Performs the opening handshake
|
int |
maxFramePayloadLength()
Gets the maximum length for any frame's payload.
|
protected abstract FullHttpResponse |
newHandshakeResponse(FullHttpRequest req,
HttpHeaders responseHeaders)
Returns a new {@link FullHttpResponse) which will be used for as response to the handshake request.
|
protected abstract io.netty.channel.ChannelInboundHandler |
newWebsocketDecoder()
Returns the decoder to use after handshake is complete.
|
protected abstract io.netty.channel.ChannelOutboundHandler |
newWebSocketEncoder()
Returns the encoder to use after the handshake is complete.
|
String |
selectedSubprotocol()
Returns the selected subprotocol.
|
protected String |
selectSubprotocol(String requestedSubprotocols)
Selects the first matching supported sub protocol
|
protected void |
setSelectedSubprotocol(String value)
Deprecated.
|
Set<String> |
subprotocols()
Returns the CSV of supported sub protocols
|
String |
uri()
Returns the URL of the web socket
|
WebSocketVersion |
version()
Returns the version of the specification being supported
|
protected static final io.netty.util.internal.logging.InternalLogger logger
public static final String SUB_PROTOCOL_WILDCARD
protected WebSocketServerHandshaker(WebSocketVersion version, String uri, String subprotocols, int maxFramePayloadLength)
version - the protocol versionuri - URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be
sent to this URL.subprotocols - CSV of supported protocols. Null if sub protocols not supported.maxFramePayloadLength - Maximum length of a frame's payloadpublic String uri()
public WebSocketVersion version()
public int maxFramePayloadLength()
public io.netty.channel.ChannelFuture handshake(io.netty.channel.Channel channel,
FullHttpRequest req)
channel - Channelreq - HTTP Requestpublic final io.netty.channel.ChannelFuture handshake(io.netty.channel.Channel channel,
FullHttpRequest req,
HttpHeaders responseHeaders,
io.netty.channel.ChannelPromise promise)
channel - Channelreq - HTTP RequestresponseHeaders - Extra headers to add to the handshake response or null if no extra headers should be addedpromise - the ChannelPromise to be notified when the opening handshake is doneprotected abstract FullHttpResponse newHandshakeResponse(FullHttpRequest req, HttpHeaders responseHeaders)
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 doneprotected String selectSubprotocol(String requestedSubprotocols)
requestedSubprotocols - CSV of protocols to be supported. e.g. "chat, superchat"public String selectedSubprotocol()
This is only available AFTER handshake() has been called.
@Deprecated protected void setSelectedSubprotocol(String value)
protected abstract io.netty.channel.ChannelInboundHandler newWebsocketDecoder()
protected abstract io.netty.channel.ChannelOutboundHandler newWebSocketEncoder()
Copyright © 2008-2013 The Netty Project. All Rights Reserved.