Class WebSocketClient

java.lang.Object
io.vertx.mutiny.core.http.WebSocketClient
All Implemented Interfaces:
MutinyDelegate, Measured

public class WebSocketClient extends Object implements Measured, MutinyDelegate
An asynchronous WebSocket client.

It allows you to open WebSockets to servers.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

Author:
Tim Fox
See Also:
  • WebSocketClient
  • Field Details

  • Constructor Details

    • WebSocketClient

      public WebSocketClient(io.vertx.core.http.WebSocketClient delegate)
      Create a new instance of WebSocketClient delegating to the given (non-null) instance of WebSocketClient.
    • WebSocketClient

      public WebSocketClient(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.core.http.WebSocketClient getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface Measured
      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • connect

      @CheckReturnValue public io.smallrye.mutiny.Uni<WebSocket> connect(int port, String host, String requestURI)
      Connect a WebSocket to the specified port, host and relative request URI.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      port - the port
      host - the host
      requestURI - the relative URI
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • WebSocketClient.connect(int, String, String)
    • connectAndAwait

      public WebSocket connectAndAwait(int port, String host, String requestURI)
      Connect a WebSocket to the specified port, host and relative request URI.

      Unlike the bare Vert.x variant, this method returns a WebSocket. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      port - the port
      host - the host
      requestURI - the relative URI
      Returns:
      The operation result
      See Also:
      • WebSocketClient.connect(int, String, String)
    • connectAndForget

      public WebSocketClient connectAndForget(int port, String host, String requestURI)
      Connect a WebSocket to the specified port, host and relative request URI.

      Unlike the bare Vert.x variant, this method ignores the WebSocket result or any failure.

      Parameters:
      port - the port
      host - the host
      requestURI - the relative URI
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • WebSocketClient.connect(int, String, String)
    • connect

      @CheckReturnValue public io.smallrye.mutiny.Uni<WebSocket> connect(String host, String requestURI)
      Connect a WebSocket to the default client port and specified host and relative request URI.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      host - the host
      requestURI - the relative URI
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • WebSocketClient.connect(String, String)
    • connectAndAwait

      public WebSocket connectAndAwait(String host, String requestURI)
      Connect a WebSocket to the default client port and specified host and relative request URI.

      Unlike the bare Vert.x variant, this method returns a WebSocket. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      host - the host
      requestURI - the relative URI
      Returns:
      The operation result
      See Also:
      • WebSocketClient.connect(String, String)
    • connectAndForget

      public WebSocketClient connectAndForget(String host, String requestURI)
      Connect a WebSocket to the default client port and specified host and relative request URI.

      Unlike the bare Vert.x variant, this method ignores the WebSocket result or any failure.

      Parameters:
      host - the host
      requestURI - the relative URI
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • WebSocketClient.connect(String, String)
    • connect

      @CheckReturnValue public io.smallrye.mutiny.Uni<WebSocket> connect(String requestURI)
      Connect a WebSocket to the default client port, default client host and specified, relative request URI.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      requestURI - the relative URI
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • WebSocketClient.connect(String)
    • connectAndAwait

      public WebSocket connectAndAwait(String requestURI)
      Connect a WebSocket to the default client port, default client host and specified, relative request URI.

      Unlike the bare Vert.x variant, this method returns a WebSocket. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      requestURI - the relative URI
      Returns:
      The operation result
      See Also:
      • WebSocketClient.connect(String)
    • connectAndForget

      public WebSocketClient connectAndForget(String requestURI)
      Connect a WebSocket to the default client port, default client host and specified, relative request URI.

      Unlike the bare Vert.x variant, this method ignores the WebSocket result or any failure.

      Parameters:
      requestURI - the relative URI
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • WebSocketClient.connect(String)
    • connect

      @CheckReturnValue public io.smallrye.mutiny.Uni<WebSocket> connect(io.vertx.core.http.WebSocketConnectOptions options)
      Connect a WebSocket with the specified options.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      options - the request options
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • WebSocketClient.connect(WebSocketConnectOptions)
    • connectAndAwait

      public WebSocket connectAndAwait(io.vertx.core.http.WebSocketConnectOptions options)
      Connect a WebSocket with the specified options.

      Unlike the bare Vert.x variant, this method returns a WebSocket. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      options - the request options
      Returns:
      The operation result
      See Also:
      • WebSocketClient.connect(WebSocketConnectOptions)
    • connectAndForget

      public WebSocketClient connectAndForget(io.vertx.core.http.WebSocketConnectOptions options)
      Connect a WebSocket with the specified options.

      Unlike the bare Vert.x variant, this method ignores the WebSocket result or any failure.

      Parameters:
      options - the request options
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • WebSocketClient.connect(WebSocketConnectOptions)
    • shutdown

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> shutdown()
      Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • WebSocketClient.shutdown()
    • shutdownAndAwait

      public void shutdownAndAwait()
      Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      See Also:
      • WebSocketClient.shutdown()
    • shutdownAndForget

      public WebSocketClient shutdownAndForget()
      Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • WebSocketClient.shutdown()
    • close

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
      Close immediately (shutdown(0, TimeUnit.SECONDS).

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • WebSocketClient.close()
    • closeAndAwait

      public void closeAndAwait()
      Close immediately (shutdown(0, TimeUnit.SECONDS).

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      See Also:
      • WebSocketClient.close()
    • closeAndForget

      public WebSocketClient closeAndForget()
      Close immediately (shutdown(0, TimeUnit.SECONDS).

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • WebSocketClient.close()
    • updateSSLOptions

      @CheckReturnValue public io.smallrye.mutiny.Uni<Boolean> updateSSLOptions(io.vertx.core.net.ClientSSLOptions options)
      Update the client with new SSL options, the update happens if the options object is valid and different from the existing options object.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      options - the new SSL options
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • WebSocketClient.updateSSLOptions(ClientSSLOptions)
    • updateSSLOptionsAndAwait

      public Boolean updateSSLOptionsAndAwait(io.vertx.core.net.ClientSSLOptions options)
      Update the client with new SSL options, the update happens if the options object is valid and different from the existing options object.

      Unlike the bare Vert.x variant, this method returns a Boolean. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      options - the new SSL options
      Returns:
      The operation result
      See Also:
      • WebSocketClient.updateSSLOptions(ClientSSLOptions)
    • updateSSLOptionsAndForget

      public WebSocketClient updateSSLOptionsAndForget(io.vertx.core.net.ClientSSLOptions options)
      Update the client with new SSL options, the update happens if the options object is valid and different from the existing options object.

      Unlike the bare Vert.x variant, this method ignores the Boolean result or any failure.

      Parameters:
      options - the new SSL options
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • WebSocketClient.updateSSLOptions(ClientSSLOptions)
    • updateSSLOptions

      @CheckReturnValue public io.smallrye.mutiny.Uni<Boolean> updateSSLOptions(io.vertx.core.net.ClientSSLOptions 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.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      options - the new SSL options
      force - force the update when options are equals
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • WebSocketClient.updateSSLOptions(ClientSSLOptions, boolean)
    • updateSSLOptionsAndAwait

      public Boolean updateSSLOptionsAndAwait(io.vertx.core.net.ClientSSLOptions 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.

      Unlike the bare Vert.x variant, this method returns a Boolean. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      options - the new SSL options
      force - force the update when options are equals
      Returns:
      The operation result
      See Also:
      • WebSocketClient.updateSSLOptions(ClientSSLOptions, boolean)
    • updateSSLOptionsAndForget

      public WebSocketClient updateSSLOptionsAndForget(io.vertx.core.net.ClientSSLOptions 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.

      Unlike the bare Vert.x variant, this method ignores the Boolean result or any failure.

      Parameters:
      options - the new SSL options
      force - force the update when options are equals
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • WebSocketClient.updateSSLOptions(ClientSSLOptions, boolean)
    • shutdown

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> shutdown(long timeout, TimeUnit unit)
      Calls shutdown(Duration).

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • WebSocketClient.shutdown(long, TimeUnit)
    • shutdownAndAwait

      public void shutdownAndAwait(long timeout, TimeUnit unit)
      Calls shutdown(Duration).

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      See Also:
      • WebSocketClient.shutdown(long, TimeUnit)
    • shutdownAndForget

      public WebSocketClient shutdownAndForget(long timeout, TimeUnit unit)
      Calls shutdown(Duration).

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • WebSocketClient.shutdown(long, TimeUnit)
    • shutdown

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> shutdown(Duration timeout)
      Initiate the client shutdown sequence.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      timeout - the amount of time after which all resources are forcibly closed
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • WebSocketClient.shutdown(Duration)
    • shutdownAndAwait

      public void shutdownAndAwait(Duration timeout)
      Initiate the client shutdown sequence.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      timeout - the amount of time after which all resources are forcibly closed
      See Also:
      • WebSocketClient.shutdown(Duration)
    • shutdownAndForget

      public WebSocketClient shutdownAndForget(Duration timeout)
      Initiate the client shutdown sequence.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Parameters:
      timeout - the amount of time after which all resources are forcibly closed
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • WebSocketClient.shutdown(Duration)
    • webSocket

      public ClientWebSocket webSocket()
      Create a WebSocket that is not yet connected to the server.
      Returns:
      the client WebSocket
    • isMetricsEnabled

      public boolean isMetricsEnabled()
      Whether the metrics are enabled for this measured object
      Specified by:
      isMetricsEnabled in interface Measured
      Returns:
      true if metrics are enabled
    • newInstance

      public static WebSocketClient newInstance(io.vertx.core.http.WebSocketClient delegate)
      Creates a new instance of the WebSocketClient.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object