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_CONNECT_TIMEOUT, DEFAULT_FOLLOW_REDIRECTS, DEFAULT_HOST, DEFAULT_HTTP_METHOD, DEFAULT_IDLE_TIMEOUT, 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 |
setAbsoluteURI(String absoluteURI)
Parse an absolute URI to use, this will update the
ssl, host,
port and uri fields. |
WebSocketConnectOptions |
setAbsoluteURI(URL url)
Like
RequestOptions.setAbsoluteURI(String) but using an URL parameter. |
WebSocketConnectOptions |
setAllowOriginHeader(boolean allowOriginHeader)
Set whether to add the
origin header to the WebSocket handshake request, enabled by default. |
WebSocketConnectOptions |
setConnectTimeout(long timeout)
Sets the amount of time after which, if the request is not obtained from the client within the timeout period,
the
Future<HttpClientRequest> obtained from the client is failed with a TimeoutException. |
WebSocketConnectOptions |
setFollowRedirects(Boolean followRedirects)
Set whether to follow HTTP redirect
|
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 |
setIdleTimeout(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 |
setMethod(HttpMethod method)
Set the HTTP method 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 |
setServer(SocketAddress server)
Set the server address to be used by the client request.
|
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 |
setTraceOperation(String op)
Override the operation the tracer use for this request.
|
WebSocketConnectOptions |
setURI(String uri)
Set the request relative URI.
|
WebSocketConnectOptions |
setVersion(WebsocketVersion version)
Set the WebSocket version.
|
JsonObject |
toJson() |
getConnectTimeout, getFollowRedirects, getHeaders, getHost, getIdleTimeout, getMethod, getPort, getServer, getTimeout, getTraceOperation, getURI, isSsl, removeHeader, removeHeaderpublic 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 setConnectTimeout(long timeout)
RequestOptionsFuture<HttpClientRequest> obtained from the client is failed with a TimeoutException.
Note this is not related to the TCP HttpClientOptions.setConnectTimeout(int) option, when a request is made against
a pooled HTTP client, the timeout applies to the duration to obtain a connection from the pool to serve the request, the timeout
might fire because the server does not respond in time or the pool is too busy to serve a request.setConnectTimeout in class RequestOptionstimeout - the amount of time in milliseconds.public WebSocketConnectOptions setIdleTimeout(long timeout)
WebSocketHandshakeException will be passed to the exception handler and the connection will be closed.setIdleTimeout 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 WebSocketConnectOptions setServer(SocketAddress server)
RequestOptions When the server address is null, the address will be resolved after the host
property by the Vert.x resolver.
Use this when you want to connect to a specific server address without name resolution.
setServer in class RequestOptionspublic WebSocketConnectOptions setMethod(HttpMethod method)
RequestOptionssetMethod in class RequestOptionspublic WebSocketConnectOptions setFollowRedirects(Boolean followRedirects)
RequestOptionssetFollowRedirects in class RequestOptionsfollowRedirects - whether to follow redirectpublic WebSocketConnectOptions setAbsoluteURI(String absoluteURI)
RequestOptionsssl, host,
port and uri fields.setAbsoluteURI in class RequestOptionsabsoluteURI - the uri to usepublic WebSocketConnectOptions setAbsoluteURI(URL url)
RequestOptionsRequestOptions.setAbsoluteURI(String) but using an URL parameter.setAbsoluteURI in class RequestOptionsurl - the uri to usepublic WebSocketConnectOptions setTraceOperation(String op)
RequestOptionssetTraceOperation in class RequestOptionsop - the overridepublic 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.