public class WebSocketConnectOptions extends RequestOptions
HttpClient
connect a WebSocket
.Modifier and Type | Field and Description |
---|---|
static List<String> |
DEFAULT_SUB_PROTOCOLS
The default WebSocket sub protocols =
null |
static WebsocketVersion |
DEFAULT_VERSION
The default WebSocket version =
WebsocketVersion.V13 |
DEFAULT_HOST, DEFAULT_PORT, DEFAULT_SSL, DEFAULT_URI
Constructor and Description |
---|
WebSocketConnectOptions() |
WebSocketConnectOptions(JsonObject json) |
WebSocketConnectOptions(RequestOptions other) |
WebSocketConnectOptions(WebSocketConnectOptions other) |
Modifier and Type | Method and Description |
---|---|
WebSocketConnectOptions |
addHeader(String key,
String value)
Add a request header.
|
WebSocketConnectOptions |
addSubProtocol(String subprotocol)
Add a WebSocket sub protocol to use.
|
List<String> |
getSubProtocols() |
WebsocketVersion |
getVersion() |
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(int port)
Set the port 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 |
setURI(String uri)
Set the request relative URI
|
WebSocketConnectOptions |
setVersion(WebsocketVersion version)
Set the WebSocket version.
|
JsonObject |
toJson() |
getHeaders, getHost, getPort, getURI, isSsl
public static final WebsocketVersion DEFAULT_VERSION
WebsocketVersion.V13
public WebSocketConnectOptions()
public WebSocketConnectOptions(WebSocketConnectOptions other)
public WebSocketConnectOptions(RequestOptions 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 WebSocketConnectOptions setHost(String host)
RequestOptions
setHost
in class RequestOptions
public WebSocketConnectOptions setPort(int port)
RequestOptions
setPort
in class RequestOptions
public WebSocketConnectOptions setSsl(Boolean ssl)
RequestOptions
setSsl
in class RequestOptions
ssl
- true if enabledpublic WebSocketConnectOptions setURI(String uri)
RequestOptions
setURI
in class RequestOptions
uri
- the relative uripublic WebSocketConnectOptions addHeader(String key, String value)
RequestOptions
addHeader
in class RequestOptions
key
- the header keyvalue
- the header valuepublic WebSocketConnectOptions setHeaders(MultiMap headers)
RequestOptions
setHeaders
in class RequestOptions
headers
- the headerspublic JsonObject toJson()
toJson
in class RequestOptions
Copyright © 2023 Eclipse. All rights reserved.