public abstract class WebSocketServerHandshaker extends Object
Modifier and Type | Field and Description |
---|---|
static ChannelFutureListener |
HANDSHAKE_LISTENER
ChannelFutureListener which will call
Channels.fireExceptionCaught(ChannelHandlerContext, Throwable)
if the ChannelFuture was not successful. |
static String |
SUB_PROTOCOL_WILDCARD
Use this as wildcard to support all requested sub-protocols
|
Modifier | Constructor and Description |
---|---|
protected |
WebSocketServerHandshaker(WebSocketVersion version,
String webSocketUrl,
String subprotocols)
Constructor using default values
|
protected |
WebSocketServerHandshaker(WebSocketVersion version,
String webSocketUrl,
String subprotocols,
long maxFramePayloadLength)
Constructor specifying the destination web socket location
|
Modifier and Type | Method and Description |
---|---|
abstract ChannelFuture |
close(Channel channel,
CloseWebSocketFrame frame)
Performs the closing handshake
|
long |
getMaxFramePayloadLength()
Returns the max length for any frame's payload
|
String |
getSelectedSubprotocol()
Returns the selected subprotocol.
|
Set<String> |
getSubprotocols()
Returns the CSV of supported sub protocols
|
WebSocketVersion |
getVersion()
Returns the version of the specification being supported
|
String |
getWebSocketUrl()
Returns the URL of the web socket
|
abstract ChannelFuture |
handshake(Channel channel,
HttpRequest req)
Performs the opening handshake
|
protected String |
selectSubprotocol(String requestedSubprotocols)
Selects the first matching supported sub protocol
|
protected void |
setSelectedSubprotocol(String value) |
protected ChannelFuture |
writeHandshakeResponse(Channel channel,
HttpResponse res,
ChannelHandler encoder,
ChannelHandler decoder)
Upgrades the connection and send the handshake response.
|
public static final String SUB_PROTOCOL_WILDCARD
public static final ChannelFutureListener HANDSHAKE_LISTENER
ChannelFutureListener
which will call
Channels.fireExceptionCaught(ChannelHandlerContext, Throwable)
if the ChannelFuture
was not successful.protected WebSocketServerHandshaker(WebSocketVersion version, String webSocketUrl, String subprotocols)
version
- the protocol versionwebSocketUrl
- 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.protected WebSocketServerHandshaker(WebSocketVersion version, String webSocketUrl, String subprotocols, long maxFramePayloadLength)
version
- the protocol versionwebSocketUrl
- 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 getWebSocketUrl()
public WebSocketVersion getVersion()
public long getMaxFramePayloadLength()
public abstract ChannelFuture handshake(Channel channel, HttpRequest req)
channel
- Channelreq
- HTTP Requestprotected ChannelFuture writeHandshakeResponse(Channel channel, HttpResponse res, ChannelHandler encoder, ChannelHandler decoder)
public abstract ChannelFuture close(Channel channel, CloseWebSocketFrame frame)
channel
- Channelframe
- Closing Frame that was receivedprotected String selectSubprotocol(String requestedSubprotocols)
requestedSubprotocols
- CSV of protocols to be supported. e.g. "chat, superchat"public String getSelectedSubprotocol()
This is only available AFTER handshake() has been called.
protected void setSelectedSubprotocol(String value)
Copyright © 2008-2014 The Netty Project. All Rights Reserved.