Top Description Fields Constructors Methods
io.vertx.core.http

public Class WebSocketConnectOptions

extends RequestOptions
Class Inheritance
Annotations
@DataObject
@JsonGen
publicConverter:false
Imports
io.netty.handler.codec.http.websocketx.WebSocketHandshakeException, io.vertx.codegen.annotations.DataObject, .GenIgnore, io.vertx.codegen.json.annotations.JsonGen, io.vertx.core.MultiMap, io.vertx.core.json.JsonObject, io.vertx.core.net.ProxyOptions, .SocketAddress, java.net.URI, .URISyntaxException, .URL, java.util.ArrayList, .List

Options describing how an HttpClient connect a WebSocket.
Author
Julien Viet

Field Summary

Modifier and TypeField and Description
private boolean
public static final boolean
DEFAULT_ALLOW_ORIGIN_HEADER

The default WebSocket allow origin header = true

public static final ProxyOptions
DEFAULT_PROXY_OPTIONS

Hides io.vertx.core.http.RequestOptions.DEFAULT_PROXY_OPTIONS.

The default value for proxy options = null
public static final boolean
DEFAULT_REGISTER_WRITE_HANDLERS

Whether write-handlers should be registered by default = false.

public static final List<String>
DEFAULT_SUB_PROTOCOLS

The default WebSocket sub protocols = null

public static final WebsocketVersion
DEFAULT_VERSION

The default WebSocket version = WebsocketVersion#V13

private ProxyOptions
private boolean
private List<String>
private WebsocketVersion
Inherited from io.vertx.core.http.RequestOptions:
DEFAULT_CONNECT_TIMEOUTDEFAULT_FOLLOW_REDIRECTSDEFAULT_HOSTDEFAULT_HTTP_METHODDEFAULT_IDLE_TIMEOUTDEFAULT_PORTDEFAULT_SERVERDEFAULT_SSLDEFAULT_TIMEOUTDEFAULT_URI

Constructor Summary

AccessConstructor and Description
public
public
public
WebSocketConnectOptions(JsonObject json)
References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Method Summary

Modifier and TypeMethod and Description
public WebSocketConnectOptions
addHeader(String
the header key
key
,
String
the header value
value
)

Overrides io.vertx.core.http.RequestOptions.addHeader.

Add a request header.

public WebSocketConnectOptions
addHeader(CharSequence
the header key
key
,
CharSequence
the header value
value
)

Overrides io.vertx.core.http.RequestOptions.addHeader.

Add a request header.

public WebSocketConnectOptions
public WebSocketConnectOptions

Returns:

a reference to this, so the API can be used fluently
addSubProtocol
(String subprotocol)

Add a WebSocket sub protocol to use.

public boolean

Returns:

whether to add the origin header to the WebSocket handshake request
getAllowOriginHeader
()

public ProxyOptions

Returns:

proxy options override
getProxyOptions
()

Overrides io.vertx.core.http.RequestOptions.getProxyOptions.

Get the proxy options override for connections

public List<String>

Returns:

the list of WebSocket sub protocols or null if there are none
getSubProtocols
()

public WebsocketVersion

Returns:

the WebSocket version
getVersion
()

public boolean

Returns:

true if write-handlers should be registered on the io.vertx.core.eventbus.EventBus, otherwise false
isRegisterWriteHandlers
()

public WebSocketConnectOptions
putHeader(String
the header key
key
,
String
the header value
value
)

Overrides io.vertx.core.http.RequestOptions.putHeader.

Set a request header.

public WebSocketConnectOptions
putHeader(CharSequence
the header key
key
,
CharSequence
the header value
value
)

Overrides io.vertx.core.http.RequestOptions.putHeader.

Set a request header.

public WebSocketConnectOptions
public WebSocketConnectOptions
setAbsoluteURI(String
the uri to use
absoluteURI
)

Overrides io.vertx.core.http.RequestOptions.setAbsoluteURI.

Parse an absolute URI to use, this will update the ssl, host, port and uri fields.

public WebSocketConnectOptions
setAbsoluteURI(URL
the uri to use
url
)

Overrides io.vertx.core.http.RequestOptions.setAbsoluteURI.

Like setAbsoluteURI(String) but using an URL parameter.

private void
public WebSocketConnectOptions

Returns:

a reference to this, so the API can be used fluently
setAllowOriginHeader
(boolean
whether to add the origin header to the WebSocket handshake request
allowOriginHeader
)

Set whether to add the origin header to the WebSocket handshake request, enabled by default.

public WebSocketConnectOptions
setConnectTimeout(long
the amount of time in milliseconds.
timeout
)

Overrides io.vertx.core.http.RequestOptions.setConnectTimeout.

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 java.util.concurrent.TimeoutException.

public WebSocketConnectOptions
setFollowRedirects(Boolean
whether to follow redirect
followRedirects
)

Overrides io.vertx.core.http.RequestOptions.setFollowRedirects.

Set whether to follow HTTP redirect

public WebSocketConnectOptions
setHeaders(MultiMap
the headers
headers
)

Overrides io.vertx.core.http.RequestOptions.setHeaders.

Set request headers from a multi-map.

public WebSocketConnectOptions
setHost(String host)

Overrides io.vertx.core.http.RequestOptions.setHost.

Set the host name to be used by the client request.

public WebSocketConnectOptions

Returns:

a reference to this, so the API can be used fluently
setIdleTimeout
(long
the amount of time in milliseconds.
timeout
)

Overrides io.vertx.core.http.RequestOptions.setIdleTimeout.

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.

public WebSocketConnectOptions
setMethod(HttpMethod method)

Overrides io.vertx.core.http.RequestOptions.setMethod.

Set the HTTP method to be used by the client request.

public WebSocketConnectOptions
setPort(Integer port)

Overrides io.vertx.core.http.RequestOptions.setPort.

Set the port to be used by the client request.

public RequestOptions

Returns:

a reference to this, so the API can be used fluently
setProxyOptions
(ProxyOptions
proxy options override object
proxyOptions
)

Overrides io.vertx.core.http.RequestOptions.setProxyOptions.

Override the HttpClientOptions#setProxyOptions(ProxyOptions) proxy options for connections.

public WebSocketConnectOptions

Returns:

a reference to this, so the API can be used fluently
setRegisterWriteHandlers
(boolean
true to register write-handlers
registerWriteHandlers
)

Whether write-handlers should be registered on the io.vertx.core.eventbus.EventBus.

public WebSocketConnectOptions
setServer(SocketAddress server)

Overrides io.vertx.core.http.RequestOptions.setServer.

Set the server address to be used by the client request.

public WebSocketConnectOptions
setSsl(Boolean
true if enabled
ssl
)

Overrides io.vertx.core.http.RequestOptions.setSsl.

Set whether SSL/TLS is enabled.

public WebSocketConnectOptions

Returns:

a reference to this, so the API can be used fluently
setSubProtocols
(List<String> subProtocols)

Set the WebSocket sub protocols to use.

public WebSocketConnectOptions

Returns:

a reference to this, so the API can be used fluently
setTimeout
(long
the amount of time in milliseconds.
timeout
)

Overrides io.vertx.core.http.RequestOptions.setTimeout.

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.

public WebSocketConnectOptions
setTraceOperation(String
the override
op
)

Overrides io.vertx.core.http.RequestOptions.setTraceOperation.

Override the operation the tracer use for this request.

public WebSocketConnectOptions
setURI(String
the relative uri
uri
)

Overrides io.vertx.core.http.RequestOptions.setURI.

Set the request relative URI.

public WebSocketConnectOptions

Returns:

a reference to this, so the API can be used fluently
setVersion
(WebsocketVersion version)

Set the WebSocket version.

public JsonObject
toJson()

Overrides io.vertx.core.http.RequestOptions.toJson.

References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Inherited from io.vertx.core.http.RequestOptions:
getConnectTimeoutgetFollowRedirectsgetHeadersgetHostgetIdleTimeoutgetMethodgetPortgetServergetTimeoutgetTraceOperationgetURIisSslremoveHeaderremoveHeader

Field Detail

allowOriginHeaderback to summary
private boolean allowOriginHeader
DEFAULT_ALLOW_ORIGIN_HEADERback to summary
public static final boolean DEFAULT_ALLOW_ORIGIN_HEADER

The default WebSocket allow origin header = true

DEFAULT_PROXY_OPTIONSback to summary
public static final ProxyOptions DEFAULT_PROXY_OPTIONS

Hides io.vertx.core.http.RequestOptions.DEFAULT_PROXY_OPTIONS.

The default value for proxy options = null

DEFAULT_REGISTER_WRITE_HANDLERSback to summary
public static final boolean DEFAULT_REGISTER_WRITE_HANDLERS

Whether write-handlers should be registered by default = false.

DEFAULT_SUB_PROTOCOLSback to summary
public static final List<String> DEFAULT_SUB_PROTOCOLS

The default WebSocket sub protocols = null

DEFAULT_VERSIONback to summary
public static final WebsocketVersion DEFAULT_VERSION

The default WebSocket version = WebsocketVersion#V13

proxyOptionsback to summary
private ProxyOptions proxyOptions

Hides io.vertx.core.http.RequestOptions.proxyOptions.

registerWriteHandlersback to summary
private boolean registerWriteHandlers
subProtocolsback to summary
private List<String> subProtocols
versionback to summary
private WebsocketVersion version

Constructor Detail

WebSocketConnectOptionsback to summary
public WebSocketConnectOptions()
WebSocketConnectOptionsback to summary
public WebSocketConnectOptions(WebSocketConnectOptions other)
WebSocketConnectOptionsback to summary
public WebSocketConnectOptions(JsonObject json)

References Deprecated

JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Method Detail

addHeaderback to summary
public WebSocketConnectOptions addHeader(String key, String value)

Overrides io.vertx.core.http.RequestOptions.addHeader.

Doc from io.vertx.core.http.RequestOptions.addHeader.

Add a request header.

Parameters
key:String

the header key

value:String

the header value

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
addHeaderback to summary
public WebSocketConnectOptions addHeader(CharSequence key, CharSequence value)

Overrides io.vertx.core.http.RequestOptions.addHeader.

Doc from io.vertx.core.http.RequestOptions.addHeader.

Add a request header.

Parameters
key:CharSequence

the header key

value:CharSequence

the header value

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
addHeaderback to summary
public WebSocketConnectOptions addHeader(CharSequence key, Iterable<CharSequence> values)

Overrides io.vertx.core.http.RequestOptions.addHeader.

Annotations
@Override
addSubProtocolback to summary
public WebSocketConnectOptions addSubProtocol(String subprotocol)

Add a WebSocket sub protocol to use.

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

getAllowOriginHeaderback to summary
public boolean getAllowOriginHeader()
Returns:boolean

whether to add the origin header to the WebSocket handshake request

getProxyOptionsback to summary
public ProxyOptions getProxyOptions()

Overrides io.vertx.core.http.RequestOptions.getProxyOptions.

Get the proxy options override for connections

Returns:ProxyOptions

proxy options override

getSubProtocolsback to summary
public List<String> getSubProtocols()
Returns:List<String>

the list of WebSocket sub protocols or null if there are none

getVersionback to summary
public WebsocketVersion getVersion()
Returns:WebsocketVersion

the WebSocket version

isRegisterWriteHandlersback to summary
public boolean isRegisterWriteHandlers()
Returns:boolean

true if write-handlers should be registered on the io.vertx.core.eventbus.EventBus, otherwise false

putHeaderback to summary
public WebSocketConnectOptions putHeader(String key, String value)

Overrides io.vertx.core.http.RequestOptions.putHeader.

Doc from io.vertx.core.http.RequestOptions.putHeader.

Set a request header.

Parameters
key:String

the header key

value:String

the header value

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
putHeaderback to summary
public WebSocketConnectOptions putHeader(CharSequence key, CharSequence value)

Overrides io.vertx.core.http.RequestOptions.putHeader.

Doc from io.vertx.core.http.RequestOptions.putHeader.

Set a request header.

Parameters
key:CharSequence

the header key

value:CharSequence

the header value

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
putHeaderback to summary
public WebSocketConnectOptions putHeader(CharSequence key, Iterable<CharSequence> values)

Overrides io.vertx.core.http.RequestOptions.putHeader.

Annotations
@Override
setAbsoluteURIback to summary
public WebSocketConnectOptions setAbsoluteURI(String absoluteURI)

Overrides io.vertx.core.http.RequestOptions.setAbsoluteURI.

Doc from io.vertx.core.http.RequestOptions.setAbsoluteURI.

Parse an absolute URI to use, this will update the ssl, host, port and uri fields.

Parameters
absoluteURI:String

the uri to use

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setAbsoluteURIback to summary
public WebSocketConnectOptions setAbsoluteURI(URL url)

Overrides io.vertx.core.http.RequestOptions.setAbsoluteURI.

Doc from io.vertx.core.http.RequestOptions.setAbsoluteURI.

Like setAbsoluteURI(String) but using an URL parameter.

Parameters
url:URL

the uri to use

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setAbsoluteURIback to summary
private void setAbsoluteURI(URI uri)
setAllowOriginHeaderback to summary
public WebSocketConnectOptions setAllowOriginHeader(boolean allowOriginHeader)

Set whether to add the origin header to the WebSocket handshake request, enabled by default.

Set to false when a server does not accept WebSocket with an origin header.

Parameters
allowOriginHeader:boolean

whether to add the origin header to the WebSocket handshake request

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

setConnectTimeoutback to summary
public WebSocketConnectOptions setConnectTimeout(long timeout)

Overrides io.vertx.core.http.RequestOptions.setConnectTimeout.

Doc from io.vertx.core.http.RequestOptions.setConnectTimeout.

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 java.util.concurrent.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.

Parameters
timeout:long

the amount of time in milliseconds.

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setFollowRedirectsback to summary
public WebSocketConnectOptions setFollowRedirects(Boolean followRedirects)

Overrides io.vertx.core.http.RequestOptions.setFollowRedirects.

Doc from io.vertx.core.http.RequestOptions.setFollowRedirects.

Set whether to follow HTTP redirect

Parameters
followRedirects:Boolean

whether to follow redirect

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setHeadersback to summary
public WebSocketConnectOptions setHeaders(MultiMap headers)

Overrides io.vertx.core.http.RequestOptions.setHeaders.

Doc from io.vertx.core.http.RequestOptions.setHeaders.

Set request headers from a multi-map.

Parameters
headers:MultiMap

the headers

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@GenIgnore
@Override
setHostback to summary
public WebSocketConnectOptions setHost(String host)

Overrides io.vertx.core.http.RequestOptions.setHost.

Doc from io.vertx.core.http.RequestOptions.setHost.

Set the host name to be used by the client request.

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setIdleTimeoutback to summary
public WebSocketConnectOptions setIdleTimeout(long timeout)

Overrides io.vertx.core.http.RequestOptions.setIdleTimeout.

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.

Parameters
timeout:long

the amount of time in milliseconds.

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setMethodback to summary
public WebSocketConnectOptions setMethod(HttpMethod method)

Overrides io.vertx.core.http.RequestOptions.setMethod.

Doc from io.vertx.core.http.RequestOptions.setMethod.

Set the HTTP method to be used by the client request.

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setPortback to summary
public WebSocketConnectOptions setPort(Integer port)

Overrides io.vertx.core.http.RequestOptions.setPort.

Doc from io.vertx.core.http.RequestOptions.setPort.

Set the port to be used by the client request.

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setProxyOptionsback to summary
public RequestOptions setProxyOptions(ProxyOptions proxyOptions)

Overrides io.vertx.core.http.RequestOptions.setProxyOptions.

Override the HttpClientOptions#setProxyOptions(ProxyOptions) proxy options for connections.

Parameters
proxyOptions:ProxyOptions

proxy options override object

Returns:RequestOptions

a reference to this, so the API can be used fluently

setRegisterWriteHandlersback to summary
public WebSocketConnectOptions setRegisterWriteHandlers(boolean registerWriteHandlers)

Whether write-handlers should be registered on the io.vertx.core.eventbus.EventBus.

Defaults to false.

Parameters
registerWriteHandlers:boolean

true to register write-handlers

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

See Also
WebSocketBase#textHandlerID(), WebSocketBase#binaryHandlerID()
setServerback to summary
public WebSocketConnectOptions setServer(SocketAddress server)

Overrides io.vertx.core.http.RequestOptions.setServer.

Doc from io.vertx.core.http.RequestOptions.setServer.

Set the server address to be used by the client request.

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.

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setSslback to summary
public WebSocketConnectOptions setSsl(Boolean ssl)

Overrides io.vertx.core.http.RequestOptions.setSsl.

Doc from io.vertx.core.http.RequestOptions.setSsl.

Set whether SSL/TLS is enabled.

Parameters
ssl:Boolean

true if enabled

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setSubProtocolsback to summary
public WebSocketConnectOptions setSubProtocols(List<String> subProtocols)

Set the WebSocket sub protocols to use.

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

setTimeoutback to summary
public WebSocketConnectOptions setTimeout(long timeout)

Overrides io.vertx.core.http.RequestOptions.setTimeout.

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.

Parameters
timeout:long

the amount of time in milliseconds.

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setTraceOperationback to summary
public WebSocketConnectOptions setTraceOperation(String op)

Overrides io.vertx.core.http.RequestOptions.setTraceOperation.

Doc from io.vertx.core.http.RequestOptions.setTraceOperation.

Override the operation the tracer use for this request. When no operation is set, the HTTP method is used instead.

Parameters
op:String

the override

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setURIback to summary
public WebSocketConnectOptions setURI(String uri)

Overrides io.vertx.core.http.RequestOptions.setURI.

Doc from io.vertx.core.http.RequestOptions.setURI.

Set the request relative URI.

Parameters
uri:String

the relative uri

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

Annotations
@Override
setVersionback to summary
public WebSocketConnectOptions setVersion(WebsocketVersion version)

Set the WebSocket version.

Returns:WebSocketConnectOptions

a reference to this, so the API can be used fluently

toJsonback to summary
public JsonObject toJson()

Overrides io.vertx.core.http.RequestOptions.toJson.

References Deprecated

JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Annotations
@Override