Class WebSocketClientProtocolConfig.Builder
java.lang.Object
io.netty.handler.codec.http.websocketx.WebSocketClientProtocolConfig.Builder
- Enclosing class:
WebSocketClientProtocolConfig
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private boolean
private boolean
private HttpHeaders
private boolean
private long
private boolean
private boolean
private long
private int
private boolean
private WebSocketCloseStatus
private String
private WebSocketVersion
private URI
private boolean
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Builder
(WebSocketClientProtocolConfig clientConfig) private
Builder
(URI webSocketUri, String subprotocol, WebSocketVersion version, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, boolean handleCloseFrames, WebSocketCloseStatus sendCloseFrame, boolean dropPongFrames, long handshakeTimeoutMillis, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, boolean generateOriginHeader, boolean withUTF8Validator) -
Method Summary
Modifier and TypeMethodDescriptionabsoluteUpgradeUrl
(boolean absoluteUpgradeUrl) Use an absolute url for the Upgrade request, typically when connecting through an HTTP proxy over clear HTTPallowExtensions
(boolean allowExtensions) Allow extensions to be used in the reserved bits of the web socket frameallowMaskMismatch
(boolean allowMaskMismatch) When set to true, frames which are not masked properly according to the standard will still be accepted.build()
Build unmodifiable client protocol configuration.customHeaders
(HttpHeaders customHeaders) Map of custom headers to add to the client requestdropPongFrames
(boolean dropPongFrames) true
if pong frames should not be forwardedforceCloseTimeoutMillis
(long forceCloseTimeoutMillis) Close the connection if it was not closed by the server after timeout specifiedgenerateOriginHeader
(boolean generateOriginHeader) Allows to generate the `Origin`|`Sec-WebSocket-Origin` header value for handshake request according the given webSocketURI.handleCloseFrames
(boolean handleCloseFrames) true
if close frames should not be forwarded and just close the channelhandshakeTimeoutMillis
(long handshakeTimeoutMillis) Handshake timeout in mills, when handshake timeout, will trigger user eventWebSocketClientProtocolHandler.ClientHandshakeStateEvent.HANDSHAKE_TIMEOUT
maxFramePayloadLength
(int maxFramePayloadLength) Maximum length of a frame's payloadperformMasking
(boolean performMasking) Whether to mask all written websocket frames.sendCloseFrame
(WebSocketCloseStatus sendCloseFrame) Close frame to send, when close frame was not send manually.subprotocol
(String subprotocol) Sub protocol request sent to the server.version
(WebSocketVersion version) Version of web socket specification to use to connect to the serverwebSocketUri
(String webSocketUri) URL for web socket communications.webSocketUri
(URI webSocketUri) URL for web socket communications.withUTF8Validator
(boolean withUTF8Validator) Toggles UTF8 validation for payload of text websocket frames.
-
Field Details
-
webSocketUri
-
subprotocol
-
version
-
allowExtensions
private boolean allowExtensions -
customHeaders
-
maxFramePayloadLength
private int maxFramePayloadLength -
performMasking
private boolean performMasking -
allowMaskMismatch
private boolean allowMaskMismatch -
handleCloseFrames
private boolean handleCloseFrames -
sendCloseFrame
-
dropPongFrames
private boolean dropPongFrames -
handshakeTimeoutMillis
private long handshakeTimeoutMillis -
forceCloseTimeoutMillis
private long forceCloseTimeoutMillis -
absoluteUpgradeUrl
private boolean absoluteUpgradeUrl -
generateOriginHeader
private boolean generateOriginHeader -
withUTF8Validator
private boolean withUTF8Validator
-
-
Constructor Details
-
Builder
-
Builder
private Builder(URI webSocketUri, String subprotocol, WebSocketVersion version, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, boolean handleCloseFrames, WebSocketCloseStatus sendCloseFrame, boolean dropPongFrames, long handshakeTimeoutMillis, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, boolean generateOriginHeader, boolean withUTF8Validator)
-
-
Method Details
-
webSocketUri
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL. -
webSocketUri
URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL. -
subprotocol
Sub protocol request sent to the server. -
version
Version of web socket specification to use to connect to the server -
allowExtensions
Allow extensions to be used in the reserved bits of the web socket frame -
customHeaders
Map of custom headers to add to the client request -
maxFramePayloadLength
Maximum length of a frame's payload -
performMasking
Whether to mask all written websocket frames. This must be set to true in order to be fully compatible with the websocket specifications. Client applications that communicate with a non-standard server which doesn't require masking might set this to false to achieve a higher performance. -
allowMaskMismatch
When set to true, frames which are not masked properly according to the standard will still be accepted. -
handleCloseFrames
true
if close frames should not be forwarded and just close the channel -
sendCloseFrame
Close frame to send, when close frame was not send manually. Ornull
to disable proper close. -
dropPongFrames
true
if pong frames should not be forwarded -
handshakeTimeoutMillis
Handshake timeout in mills, when handshake timeout, will trigger user eventWebSocketClientProtocolHandler.ClientHandshakeStateEvent.HANDSHAKE_TIMEOUT
-
forceCloseTimeoutMillis
Close the connection if it was not closed by the server after timeout specified -
absoluteUpgradeUrl
Use an absolute url for the Upgrade request, typically when connecting through an HTTP proxy over clear HTTP -
generateOriginHeader
Allows to generate the `Origin`|`Sec-WebSocket-Origin` header value for handshake request according the given webSocketURI. Usually it's not necessary and can be disabled, but for backward compatibility is set totrue
as default. -
withUTF8Validator
Toggles UTF8 validation for payload of text websocket frames. By default validation is enabled. -
build
Build unmodifiable client protocol configuration.
-