io.vertx.core.http

## Interface WebSocketClient

- All Superinterfaces:
    Measured

      public interface WebSocketClient
      extends Measured

  An asynchronous WebSocket client.

  It allows you to open WebSockets to servers.

  Author:
    Tim Fox

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `Future<Void>` | `close()` Like `close(Handler)` but returns a `Future` of the asynchronous result
    `void` | `close(Handler<AsyncResult<Void>> handler)` Close the client.
    `default Future<WebSocket>` | `connect(int port, String host, String requestURI)` Like `connect(int, String, String, Handler)` but returns a `Future` of the asynchronous result
    `default void` | `connect(int port, String host, String requestURI, Handler<AsyncResult<WebSocket>> handler)` Connect a WebSocket to the specified port, host and relative request URI
    `default Future<WebSocket>` | `connect(String requestURI)` Like `connect(String, Handler)` but returns a `Future` of the asynchronous result
    `default void` | `connect(String requestURI, Handler<AsyncResult<WebSocket>> handler)` Connect a WebSocket to the default client port, default client host and specified, relative request URI.
    `default Future<WebSocket>` | `connect(String host, String requestURI)` Like `connect(String, String, Handler)` but returns a `Future` of the asynchronous result
    `default void` | `connect(String host, String requestURI, Handler<AsyncResult<WebSocket>> handler)` Connect a WebSocket to the default client port and specified host and relative request URI.
    `Future<WebSocket>` | `connect(WebSocketConnectOptions options)` Like `connect(WebSocketConnectOptions, Handler)` but returns a `Future` of the asynchronous result
    `void` | `connect(WebSocketConnectOptions options, Handler<AsyncResult<WebSocket>> handler)` Connect a WebSocket with the specified options.
    `default Future<Boolean>` | `updateSSLOptions(SSLOptions options)` Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.
    `Future<Boolean>` | `updateSSLOptions(SSLOptions options, boolean force)` Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.
    `default void` | `updateSSLOptions(SSLOptions options, boolean force, Handler<AsyncResult<Boolean>> handler)` Like `updateSSLOptions(SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
    `default void` | `updateSSLOptions(SSLOptions options, Handler<AsyncResult<Boolean>> handler)` Like `updateSSLOptions(SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
    `ClientWebSocket` | `webSocket()` Create a WebSocket that is not yet connected to the server.

    - ### Methods inherited from interface io.vertx.core.metrics.Measured

      `isMetricsEnabled`

- - ### Method Detail

    - #### webSocket

          ClientWebSocket webSocket()

      Create a WebSocket that is not yet connected to the server.
      Returns:
        the client WebSocket

    - #### connect

          default void connect(int port,
                               String host,
                               String requestURI,
                               Handler<AsyncResult<WebSocket>> handler)

      Connect a WebSocket to the specified port, host and relative request URI
      Parameters:
        `port` - the port
        `host` - the host
        `requestURI` - the relative URI
        `handler` - handler that will be called with the WebSocket when connected

    - #### connect

          default Future<WebSocket> connect(int port,
                                            String host,
                                            String requestURI)

      Like `connect(int, String, String, Handler)` but returns a `Future` of the asynchronous result

    - #### connect

          default void connect(String host,
                               String requestURI,
                               Handler<AsyncResult<WebSocket>> handler)

      Connect a WebSocket to the default client port and specified host and relative request URI.
      Parameters:
        `host` - the host
        `requestURI` - the relative URI
        `handler` - handler that will be called with the WebSocket when connected

    - #### connect

          default Future<WebSocket> connect(String host,
                                            String requestURI)

      Like `connect(String, String, Handler)` but returns a `Future` of the asynchronous result

    - #### connect

          default void connect(String requestURI,
                               Handler<AsyncResult<WebSocket>> handler)

      Connect a WebSocket to the default client port, default client host and specified, relative request URI.
      Parameters:
        `requestURI` - the relative URI
        `handler` - handler that will be called with the WebSocket when connected

    - #### connect

          default Future<WebSocket> connect(String requestURI)

      Like `connect(String, Handler)` but returns a `Future` of the asynchronous result

    - #### connect

          void connect(WebSocketConnectOptions options,
                       Handler<AsyncResult<WebSocket>> handler)

      Connect a WebSocket with the specified options.
      Parameters:
        `options` - the request options

    - #### connect

          Future<WebSocket> connect(WebSocketConnectOptions options)

      Like `connect(WebSocketConnectOptions, Handler)` but returns a `Future` of the asynchronous result

    - #### updateSSLOptions

          default Future<Boolean> updateSSLOptions(SSLOptions options)

      Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.
      Parameters:
        `options` - the new SSL options
      Returns:
        a future signaling the update success

    - #### updateSSLOptions

          default void updateSSLOptions(SSLOptions options,
                                        Handler<AsyncResult<Boolean>> handler)

      Like `updateSSLOptions(SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
      Parameters:
        `options` - the new SSL options
        `handler` - the update handler

    - #### updateSSLOptions

          Future<Boolean> updateSSLOptions(SSLOptions options,
                                           boolean force)

      Update the client with new SSL `options`, the update happens if the options object is valid and different from the existing options object.

      The `options` object is compared using its `equals` method against the existing options to prevent an update when the objects are equals since loading options can be costly, this can happen for share TCP servers. When object are equals, setting `force` to `true` forces the update.

      Parameters:
        `options` - the new SSL options
        `force` - force the update when options are equals
      Returns:
        a future signaling the update success

    - #### updateSSLOptions

          default void updateSSLOptions(SSLOptions options,
                                        boolean force,
                                        Handler<AsyncResult<Boolean>> handler)

      Like `updateSSLOptions(SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
      Parameters:
        `options` - the new SSL options
        `force` - force the update when options are equals
        `handler` - the update handler

    - #### close

          void close(Handler<AsyncResult<Void>> handler)

      Close the client. Closing will close down any pooled connections. Clients should always be closed after use.

    - #### close

          Future<Void> close()

      Like `close(Handler)` but returns a `Future` of the asynchronous result

Copyright © 2024 Eclipse. All rights reserved.