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

public Class WebSocketServerHandshakerFactory

extends Object
Class Inheritance
Imports
io.netty5.channel.Channel, io.netty5.handler.codec.http.DefaultFullHttpResponse, .HttpHeaderNames, .HttpRequest, .HttpResponse, .HttpResponseStatus, .HttpUtil, .HttpVersion, io.netty5.util.AsciiString, io.netty5.util.concurrent.Future, java.util.Objects

Auto-detects the version of the Web Socket protocol in use and creates a new proper WebSocketServerHandshaker.

Field Summary

Modifier and TypeField and Description
private final WebSocketDecoderConfig
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
WebSocketServerHandshakerFactory(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. Null if sub protocols not supported.
subprotocols
,
boolean
Allow extensions to be used in the reserved bits of the web socket frame
allowExtensions
)

Constructor specifying the destination web socket location

public
WebSocketServerHandshakerFactory(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. Null if sub protocols not supported.
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
WebSocketServerHandshakerFactory(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. Null if sub protocols not supported.
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
WebSocketServerHandshakerFactory(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. Null if sub protocols not supported.
subprotocols
,
WebSocketDecoderConfig
Frames decoder options.
decoderConfig
)

Constructor specifying the destination web socket location

Method Summary

Modifier and TypeMethod and Description
public WebSocketServerHandshaker

Returns:

A new WebSocketServerHandshaker for the requested web socket version. Null if web socket version is not supported.
newHandshaker
(HttpRequest req)

Instances a new handshaker

public static Future<Void>
sendUnsupportedVersionResponse(Channel channel)

Return that we need cannot not support the web socket version

public static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

decoderConfigback to summary
private final WebSocketDecoderConfig decoderConfig
subprotocolsback to summary
private final String subprotocols
webSocketURLback to summary
private final String webSocketURL

Constructor Detail

WebSocketServerHandshakerFactoryback to summary
public WebSocketServerHandshakerFactory(String webSocketURL, String subprotocols, boolean allowExtensions)

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. Null if sub protocols not supported.

allowExtensions:boolean

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

WebSocketServerHandshakerFactoryback to summary
public WebSocketServerHandshakerFactory(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. Null if sub protocols not supported.

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.

WebSocketServerHandshakerFactoryback to summary
public WebSocketServerHandshakerFactory(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. Null if sub protocols not supported.

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.

WebSocketServerHandshakerFactoryback to summary
public WebSocketServerHandshakerFactory(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. Null if sub protocols not supported.

decoderConfig:WebSocketDecoderConfig

Frames decoder options.

Method Detail

newHandshakerback to summary
public WebSocketServerHandshaker newHandshaker(HttpRequest req)

Instances a new handshaker

Returns:WebSocketServerHandshaker

A new WebSocketServerHandshaker for the requested web socket version. Null if web socket version is not supported.

sendUnsupportedVersionResponseback to summary
public static Future<Void> sendUnsupportedVersionResponse(Channel channel)

Return that we need cannot not support the web socket version

sendUnsupportedWebSocketVersionResponseback to summary
public static void sendUnsupportedWebSocketVersionResponse(Channel channel)
Annotations
@Deprecated