public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker
Performs server side opening and closing handshakes for RFC 6455 (originally web socket specification draft-ietf-hybi-thewebsocketprotocol-17).
Modifier and Type | Field and Description |
---|---|
static String |
WEBSOCKET_13_ACCEPT_GUID |
logger, SUB_PROTOCOL_WILDCARD
Constructor and Description |
---|
WebSocketServerHandshaker13(String webSocketURL,
String subprotocols,
boolean allowExtensions,
int maxFramePayloadLength)
Constructor specifying the destination web socket location
|
WebSocketServerHandshaker13(String webSocketURL,
String subprotocols,
boolean allowExtensions,
int maxFramePayloadLength,
boolean allowMaskMismatch)
Constructor specifying the destination web socket location
|
Modifier and Type | Method and Description |
---|---|
protected FullHttpResponse |
newHandshakeResponse(FullHttpRequest req,
HttpHeaders headers)
Handle the web socket handshake for the web socket specification HyBi versions 13-17.
|
protected WebSocketFrameDecoder |
newWebsocketDecoder()
Returns the decoder to use after handshake is complete.
|
protected WebSocketFrameEncoder |
newWebSocketEncoder()
Returns the encoder to use after the handshake is complete.
|
close, close, handshake, handshake, handshake, handshake, maxFramePayloadLength, selectedSubprotocol, selectSubprotocol, subprotocols, uri, version
public static final String WEBSOCKET_13_ACCEPT_GUID
public WebSocketServerHandshaker13(String webSocketURL, String subprotocols, boolean allowExtensions, int maxFramePayloadLength)
webSocketURL
- 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 protocolsallowExtensions
- Allow extensions to be used in the reserved bits of the web socket framemaxFramePayloadLength
- Maximum allowable frame payload length. Setting this value to your application's
requirement may reduce denial of service attacks using long data frames.public WebSocketServerHandshaker13(String webSocketURL, String subprotocols, boolean allowExtensions, int maxFramePayloadLength, boolean allowMaskMismatch)
webSocketURL
- 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 protocolsallowExtensions
- Allow extensions to be used in the reserved bits of the web socket framemaxFramePayloadLength
- Maximum allowable frame payload length. Setting this value to your application's
requirement may reduce denial of service attacks using long data frames.allowMaskMismatch
- Allows to loosen the masking requirement on received frames. When this is set to false then also
frames which are not masked properly according to the standard will still be accepted.protected FullHttpResponse newHandshakeResponse(FullHttpRequest req, HttpHeaders headers)
Handle the web socket handshake for the web socket specification HyBi versions 13-17. Versions 13-17 share the same wire protocol.
Browser 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: 13
Server response:
HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Protocol: chat
newHandshakeResponse
in class WebSocketServerHandshaker
protected WebSocketFrameDecoder newWebsocketDecoder()
WebSocketServerHandshaker
newWebsocketDecoder
in class WebSocketServerHandshaker
protected WebSocketFrameEncoder newWebSocketEncoder()
WebSocketServerHandshaker
newWebSocketEncoder
in class WebSocketServerHandshaker
Copyright © 2008–2015 The Netty Project. All rights reserved.