io.vertx.core.http

## Class WebSocketConnectOptions

- java.lang.Object
- - io.vertx.core.http.RequestOptions
  - - io.vertx.core.http.WebSocketConnectOptions

-     public class WebSocketConnectOptions
      extends RequestOptions

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

- - ### Field Summary

    Fields
    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`

    - ### Fields inherited from class io.vertx.core.http.RequestOptions

      `DEFAULT_FOLLOW_REDIRECTS, DEFAULT_HOST, DEFAULT_HTTP_METHOD, DEFAULT_PORT, DEFAULT_SERVER, DEFAULT_SSL, DEFAULT_TIMEOUT, DEFAULT_URI`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WebSocketConnectOptions()`
    `WebSocketConnectOptions(JsonObject json)`
    `WebSocketConnectOptions(WebSocketConnectOptions other)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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(Integer 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()`

    - ### Methods inherited from class io.vertx.core.http.RequestOptions

      `addHeader, addHeader, getFollowRedirects, getHeaders, getHost, getMethod, getPort, getServer, getTimeout, getURI, isSsl, putHeader, putHeader, putHeader, setAbsoluteURI, setFollowRedirects, setMethod, setServer, setTimeout`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_VERSION

          public static final WebsocketVersion DEFAULT_VERSION

      The default WebSocket version = `WebsocketVersion.V13`

    - #### DEFAULT_SUB_PROTOCOLS

          public static final List<String> DEFAULT_SUB_PROTOCOLS

      The default WebSocket sub protocols = `null`

  - ### Constructor Detail

    - #### WebSocketConnectOptions

          public WebSocketConnectOptions()

    - #### WebSocketConnectOptions

          public WebSocketConnectOptions(WebSocketConnectOptions other)

    - #### WebSocketConnectOptions

          public WebSocketConnectOptions(JsonObject json)

  - ### Method Detail

    - #### getVersion

          public WebsocketVersion getVersion()

      Returns:
        the WebSocket version

    - #### setVersion

          public WebSocketConnectOptions setVersion(WebsocketVersion version)

      Set the WebSocket version.
      Returns:
        a reference to this, so the API can be used fluently

    - #### getSubProtocols

          public List<String> getSubProtocols()

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

    - #### setSubProtocols

          public WebSocketConnectOptions setSubProtocols(List<String> subProtocols)

      Set the WebSocket sub protocols to use.
      Returns:
        a reference to this, so the API can be used fluently

    - #### addSubProtocol

          public WebSocketConnectOptions addSubProtocol(String subprotocol)

      Add a WebSocket sub protocol to use.
      Returns:
        a reference to this, so the API can be used fluently

    - #### setHost

          public WebSocketConnectOptions setHost(String host)

      Description copied from class: `RequestOptions`
      Set the host name to be used by the client request.
      Overrides:
        `setHost` in class `RequestOptions`
      Returns:
        a reference to this, so the API can be used fluently

    - #### setPort

          public WebSocketConnectOptions setPort(Integer port)

      Description copied from class: `RequestOptions`
      Set the port to be used by the client request.
      Overrides:
        `setPort` in class `RequestOptions`
      Returns:
        a reference to this, so the API can be used fluently

    - #### setSsl

          public WebSocketConnectOptions setSsl(Boolean ssl)

      Description copied from class: `RequestOptions`
      Set whether SSL/TLS is enabled.
      Overrides:
        `setSsl` in class `RequestOptions`
      Parameters:
        `ssl` - true if enabled
      Returns:
        a reference to this, so the API can be used fluently

    - #### setURI

          public WebSocketConnectOptions setURI(String uri)

      Description copied from class: `RequestOptions`
      Set the request relative URI.
      Overrides:
        `setURI` in class `RequestOptions`
      Parameters:
        `uri` - the relative uri
      Returns:
        a reference to this, so the API can be used fluently

    - #### addHeader

          public WebSocketConnectOptions addHeader(String key,
                                                   String value)

      Description copied from class: `RequestOptions`
      Add a request header.
      Overrides:
        `addHeader` in class `RequestOptions`
      Parameters:
        `key` - the header key
        `value` - the header value
      Returns:
        a reference to this, so the API can be used fluently

    - #### setHeaders

          public WebSocketConnectOptions setHeaders(MultiMap headers)

      Description copied from class: `RequestOptions`
      Set request headers from a multi-map.
      Overrides:
        `setHeaders` in class `RequestOptions`
      Parameters:
        `headers` - the headers
      Returns:
        a reference to this, so the API can be used fluently

    - #### toJson

          public JsonObject toJson()

      Overrides:
        `toJson` in class `RequestOptions`

Copyright © 2021 Eclipse. All rights reserved.