Top Description Fields Constructors Methods
io.netty5.handler.codec.http.websocketx

public Class WebSocketServerHandshaker13

extends WebSocketServerHandshaker
Class Inheritance
Imports
io.netty5.buffer.BufferAllocator, io.netty5.handler.codec.http.DefaultFullHttpResponse, .FullHttpRequest, .FullHttpResponse, .HttpHeaderNames, .HttpHeaderValues, .HttpResponseStatus, io.netty5.handler.codec.http.headers.HttpHeaders

Performs server side opening and closing handshakes for RFC 6455 (originally web socket specification draft-ietf-hybi-thewebsocketprotocol-17).

Field Summary

Inherited from io.netty5.handler.codec.http.websocketx.WebSocketServerHandshaker:
loggerSUB_PROTOCOL_WILDCARD

Constructor Summary

AccessConstructor and Description
public
WebSocketServerHandshaker13(String
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
webSocketURL
,
String
CSV of supported protocols
subprotocols
,
boolean
Allow extensions to be used in the reserved bits of the web socket frame
allowExtensions
,
int
Maximum allowable frame payload length. Setting this value to your application's requirement may reduce denial of service attacks using long data frames.
maxFramePayloadLength
)

Constructor specifying the destination web socket location

public
WebSocketServerHandshaker13(String
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
webSocketURL
,
String
CSV of supported protocols
subprotocols
,
boolean
Allow extensions to be used in the reserved bits of the web socket frame
allowExtensions
,
int
Maximum allowable frame payload length. Setting this value to your application's requirement may reduce denial of service attacks using long data frames.
maxFramePayloadLength
,
boolean
When set to true, frames which are not masked properly according to the standard will still be accepted.
allowMaskMismatch
)

Constructor specifying the destination web socket location

public
WebSocketServerHandshaker13(String
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.
webSocketURL
,
String
CSV of supported protocols
subprotocols
,
WebSocketDecoderConfig
Frames decoder configuration.
decoderConfig
)

Constructor specifying the destination web socket location

Method Summary

Modifier and TypeMethod and Description
protected FullHttpResponse
newHandshakeResponse(BufferAllocator allocator, FullHttpRequest req, HttpHeaders headers)

Implements abstract io.netty5.handler.codec.http.websocketx.WebSocketServerHandshaker.newHandshakeResponse.

Handle the web socket handshake for the web socket specification HyBi versions 13-17.

protected WebSocketFrameDecoder
newWebsocketDecoder()

Implements abstract io.netty5.handler.codec.http.websocketx.WebSocketServerHandshaker.newWebsocketDecoder.

Returns the decoder to use after handshake is complete.
protected WebSocketFrameEncoder
newWebSocketEncoder()

Implements abstract io.netty5.handler.codec.http.websocketx.WebSocketServerHandshaker.newWebSocketEncoder.

Returns the encoder to use after the handshake is complete.
Inherited from io.netty5.handler.codec.http.websocketx.WebSocketServerHandshaker:
closeclosedecoderConfighandshakehandshakehandshakehandshakemaxFramePayloadLengthselectedSubprotocolselectSubprotocolsubprotocolsuriversion

Constructor Detail

WebSocketServerHandshaker13back to summary
public WebSocketServerHandshaker13(String webSocketURL, String subprotocols, boolean allowExtensions, int maxFramePayloadLength)

Constructor specifying the destination web socket location

Parameters
webSocketURL:String

URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.

subprotocols:String

CSV of supported protocols

allowExtensions:boolean

Allow extensions to be used in the reserved bits of the web socket frame

maxFramePayloadLength:int

Maximum allowable frame payload length. Setting this value to your application's requirement may reduce denial of service attacks using long data frames.

WebSocketServerHandshaker13back to summary
public WebSocketServerHandshaker13(String webSocketURL, String subprotocols, boolean allowExtensions, int maxFramePayloadLength, boolean allowMaskMismatch)

Constructor specifying the destination web socket location

Parameters
webSocketURL:String

URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.

subprotocols:String

CSV of supported protocols

allowExtensions:boolean

Allow extensions to be used in the reserved bits of the web socket frame

maxFramePayloadLength:int

Maximum allowable frame payload length. Setting this value to your application's requirement may reduce denial of service attacks using long data frames.

allowMaskMismatch:boolean

When set to true, frames which are not masked properly according to the standard will still be accepted.

WebSocketServerHandshaker13back to summary
public WebSocketServerHandshaker13(String webSocketURL, String subprotocols, WebSocketDecoderConfig decoderConfig)

Constructor specifying the destination web socket location

Parameters
webSocketURL:String

URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL.

subprotocols:String

CSV of supported protocols

decoderConfig:WebSocketDecoderConfig

Frames decoder configuration.

Method Detail

newHandshakeResponseback to summary
protected FullHttpResponse newHandshakeResponse(BufferAllocator allocator, FullHttpRequest req, HttpHeaders headers)

Implements abstract io.netty5.handler.codec.http.websocketx.WebSocketServerHandshaker.newHandshakeResponse.

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==
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
Annotations
@Override
newWebsocketDecoderback to summary
protected WebSocketFrameDecoder newWebsocketDecoder()

Implements abstract io.netty5.handler.codec.http.websocketx.WebSocketServerHandshaker.newWebsocketDecoder.

Doc from io.netty5.handler.codec.http.websocketx.WebSocketServerHandshaker.newWebsocketDecoder.

Returns the decoder to use after handshake is complete.

Annotations
@Override
newWebSocketEncoderback to summary
protected WebSocketFrameEncoder newWebSocketEncoder()

Implements abstract io.netty5.handler.codec.http.websocketx.WebSocketServerHandshaker.newWebSocketEncoder.

Doc from io.netty5.handler.codec.http.websocketx.WebSocketServerHandshaker.newWebSocketEncoder.

Returns the encoder to use after the handshake is complete.

Annotations
@Override