public class WebSocketConnectOptions extends RequestOptions
HttpClient connect a WebSocket.| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_ALLOW_ORIGIN_HEADER
The default WebSocket allow origin header =
true |
static ProxyOptions |
DEFAULT_PROXY_OPTIONS
The default value for proxy options =
null |
static boolean |
DEFAULT_REGISTER_WRITE_HANDLERS
Whether write-handlers should be registered by default = false.
|
static List<String> |
DEFAULT_SUB_PROTOCOLS
The default WebSocket sub protocols =
null |
static WebsocketVersion |
DEFAULT_VERSION
The default WebSocket version =
WebsocketVersion.V13 |
DEFAULT_FOLLOW_REDIRECTS, DEFAULT_HOST, DEFAULT_HTTP_METHOD, DEFAULT_PORT, DEFAULT_SERVER, DEFAULT_SSL, DEFAULT_TIMEOUT, DEFAULT_URI| Constructor and Description |
|---|
WebSocketConnectOptions() |
WebSocketConnectOptions(JsonObject json) |
WebSocketConnectOptions(WebSocketConnectOptions other) |
| Modifier and Type | Method and Description |
|---|---|
WebSocketConnectOptions |
addHeader(CharSequence key,
CharSequence value)
Add a request header.
|
WebSocketConnectOptions |
addHeader(CharSequence key,
Iterable<CharSequence> values) |
WebSocketConnectOptions |
addHeader(String key,
String value)
Add a request header.
|
WebSocketConnectOptions |
addSubProtocol(String subprotocol)
Add a WebSocket sub protocol to use.
|
boolean |
getAllowOriginHeader() |
ProxyOptions |
getProxyOptions()
Get the proxy options override for connections
|
List<String> |
getSubProtocols() |
WebsocketVersion |
getVersion() |
boolean |
isRegisterWriteHandlers() |
WebSocketConnectOptions |
putHeader(CharSequence key,
CharSequence value)
Set a request header.
|
WebSocketConnectOptions |
putHeader(CharSequence key,
Iterable<CharSequence> values) |
WebSocketConnectOptions |
putHeader(String key,
String value)
Set a request header.
|
WebSocketConnectOptions |
setAllowOriginHeader(boolean allowOriginHeader)
Set whether to add the
origin header to the WebSocket handshake request, enabled by default. |
WebSocketConnectOptions |
setHeaders(MultiMap headers)
Set request headers from a multi-map.
|
WebSocketConnectOptions |
setHost(String host)
Set the host name to be used by the client request.
|
WebSocketConnectOptions |
setPort(Integer port)
Set the port to be used by the client request.
|
RequestOptions |
setProxyOptions(ProxyOptions proxyOptions)
Override the
HttpClientOptions.setProxyOptions(ProxyOptions) proxy options
for connections. |
WebSocketConnectOptions |
setRegisterWriteHandlers(boolean registerWriteHandlers)
Whether write-handlers should be registered on the
EventBus. |
WebSocketConnectOptions |
setSsl(Boolean ssl)
Set whether SSL/TLS is enabled.
|
WebSocketConnectOptions |
setSubProtocols(List<String> subProtocols)
Set the WebSocket sub protocols to use.
|
WebSocketConnectOptions |
setTimeout(long timeout)
Sets the amount of time after which if the WebSocket handshake does not happen within the timeout period an
WebSocketHandshakeException will be passed to the exception handler and the connection will be closed. |
WebSocketConnectOptions |
setURI(String uri)
Set the request relative URI.
|
WebSocketConnectOptions |
setVersion(WebsocketVersion version)
Set the WebSocket version.
|
JsonObject |
toJson() |
getFollowRedirects, getHeaders, getHost, getMethod, getPort, getServer, getTimeout, getTraceOperation, getURI, isSsl, removeHeader, removeHeader, setAbsoluteURI, setAbsoluteURI, setFollowRedirects, setMethod, setServer, setTraceOperationpublic static final ProxyOptions DEFAULT_PROXY_OPTIONS
nullpublic static final WebsocketVersion DEFAULT_VERSION
WebsocketVersion.V13public static final List<String> DEFAULT_SUB_PROTOCOLS
nullpublic static final boolean DEFAULT_ALLOW_ORIGIN_HEADER
truepublic static final boolean DEFAULT_REGISTER_WRITE_HANDLERS
public WebSocketConnectOptions()
public WebSocketConnectOptions(WebSocketConnectOptions other)
public WebSocketConnectOptions(JsonObject json)
public WebsocketVersion getVersion()
public WebSocketConnectOptions setVersion(WebsocketVersion version)
public List<String> getSubProtocols()
null if there are nonepublic WebSocketConnectOptions setSubProtocols(List<String> subProtocols)
public WebSocketConnectOptions addSubProtocol(String subprotocol)
public ProxyOptions getProxyOptions()
getProxyOptions in class RequestOptionspublic RequestOptions setProxyOptions(ProxyOptions proxyOptions)
HttpClientOptions.setProxyOptions(ProxyOptions) proxy options
for connections.setProxyOptions in class RequestOptionsproxyOptions - proxy options override objectpublic boolean getAllowOriginHeader()
origin header to the WebSocket handshake requestpublic WebSocketConnectOptions setAllowOriginHeader(boolean allowOriginHeader)
origin header to the WebSocket handshake request, enabled by default.
Set to false when a server does not accept WebSocket with an origin header.
allowOriginHeader - whether to add the origin header to the WebSocket handshake requestpublic WebSocketConnectOptions setHost(String host)
RequestOptionssetHost in class RequestOptionspublic WebSocketConnectOptions setPort(Integer port)
RequestOptionssetPort in class RequestOptionspublic WebSocketConnectOptions setSsl(Boolean ssl)
RequestOptionssetSsl in class RequestOptionsssl - true if enabledpublic WebSocketConnectOptions setURI(String uri)
RequestOptionssetURI in class RequestOptionsuri - the relative uripublic WebSocketConnectOptions setTimeout(long timeout)
WebSocketHandshakeException will be passed to the exception handler and the connection will be closed.setTimeout in class RequestOptionstimeout - the amount of time in milliseconds.public WebSocketConnectOptions addHeader(String key, String value)
RequestOptionsaddHeader in class RequestOptionskey - the header keyvalue - the header valuepublic WebSocketConnectOptions addHeader(CharSequence key, CharSequence value)
RequestOptionsaddHeader in class RequestOptionskey - the header keyvalue - the header valuepublic WebSocketConnectOptions addHeader(CharSequence key, Iterable<CharSequence> values)
addHeader in class RequestOptionspublic WebSocketConnectOptions putHeader(String key, String value)
RequestOptionsputHeader in class RequestOptionskey - the header keyvalue - the header valuepublic WebSocketConnectOptions putHeader(CharSequence key, CharSequence value)
RequestOptionsputHeader in class RequestOptionskey - the header keyvalue - the header valuepublic WebSocketConnectOptions putHeader(CharSequence key, Iterable<CharSequence> values)
putHeader in class RequestOptionspublic WebSocketConnectOptions setHeaders(MultiMap headers)
RequestOptionssetHeaders in class RequestOptionsheaders - the headerspublic JsonObject toJson()
toJson in class RequestOptionspublic boolean isRegisterWriteHandlers()
true if write-handlers should be registered on the EventBus, otherwise falsepublic WebSocketConnectOptions setRegisterWriteHandlers(boolean registerWriteHandlers)
EventBus.
Defaults to false.
registerWriteHandlers - true to register write-handlersWebSocketBase.textHandlerID(),
WebSocketBase.binaryHandlerID()Copyright © 2023 Eclipse. All rights reserved.