Class WebSocketClient

  • All Implemented Interfaces:
    Measured

    public class WebSocketClient
    extends Object
    implements Measured
    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 using Vert.x codegen.

    • Constructor Detail

      • WebSocketClient

        public WebSocketClient​(io.vertx.core.http.WebSocketClient delegate)
      • WebSocketClient

        public WebSocketClient​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.core.http.WebSocketClient getDelegate()
        Specified by:
        getDelegate in interface Measured
      • hashCode

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

        public boolean isMetricsEnabled()
        Specified by:
        isMetricsEnabled in interface Measured
        Returns:
        true if metrics are enabled
      • webSocket

        public ClientWebSocket webSocket()
        Returns:
        the client WebSocket
      • 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. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        port - the port
        host - the host
        requestURI - the relative URI
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • connectAndAwait

        public WebSocket connectAndAwait​(int port,
                                         String host,
                                         String requestURI)
        Blocking variant of connect(int,String,String).

        This method waits 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 WebSocket instance produced by the operation.
      • connectAndForget

        public void connectAndForget​(int port,
                                     String host,
                                     String requestURI)
        Variant of connect(int,String,String) that ignores the result of the operation.

        This method subscribes on the result of connect(int,String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from connect(int,String,String) but you don't need to compose it with other operations.

        Parameters:
        port - the port
        host - the host
        requestURI - the relative URI
      • 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. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        host - the host
        requestURI - the relative URI
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • connectAndAwait

        public WebSocket connectAndAwait​(String host,
                                         String requestURI)
        Blocking variant of connect(String,String).

        This method waits 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 WebSocket instance produced by the operation.
      • connectAndForget

        public void connectAndForget​(String host,
                                     String requestURI)
        Variant of connect(String,String) that ignores the result of the operation.

        This method subscribes on the result of connect(String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from connect(String,String) but you don't need to compose it with other operations.

        Parameters:
        host - the host
        requestURI - the relative URI
      • 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. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        requestURI - the relative URI
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • connectAndAwait

        public WebSocket connectAndAwait​(String requestURI)
        Blocking variant of connect(String).

        This method waits 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 WebSocket instance produced by the operation.
      • connectAndForget

        public void connectAndForget​(String requestURI)
        Variant of connect(String) that ignores the result of the operation.

        This method subscribes on the result of connect(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from connect(String) but you don't need to compose it with other operations.

        Parameters:
        requestURI - the relative URI
      • 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. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        options - the request options
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • connectAndAwait

        public WebSocket connectAndAwait​(io.vertx.core.http.WebSocketConnectOptions options)
        Blocking variant of connect(WebSocketConnectOptions).

        This method waits 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 WebSocket instance produced by the operation.
      • connectAndForget

        public void connectAndForget​(io.vertx.core.http.WebSocketConnectOptions options)
        Variant of connect(WebSocketConnectOptions) that ignores the result of the operation.

        This method subscribes on the result of connect(WebSocketConnectOptions), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from connect(WebSocketConnectOptions) but you don't need to compose it with other operations.

        Parameters:
        options - the request options
      • updateSSLOptions

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Boolean> updateSSLOptions​(io.vertx.core.net.SSLOptions options)
        Like updateSSLOptions(io.vertx.core.net.SSLOptions) but supplying a handler that will be called when the update happened (or has failed).

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        options - the new SSL options
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • updateSSLOptionsAndAwait

        public Boolean updateSSLOptionsAndAwait​(io.vertx.core.net.SSLOptions options)
        Blocking variant of updateSSLOptions(SSLOptions).

        This method waits 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 Boolean instance produced by the operation.
      • updateSSLOptionsAndForget

        public void updateSSLOptionsAndForget​(io.vertx.core.net.SSLOptions options)
        Variant of updateSSLOptions(SSLOptions) that ignores the result of the operation.

        This method subscribes on the result of updateSSLOptions(SSLOptions), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from updateSSLOptions(SSLOptions) but you don't need to compose it with other operations.

        Parameters:
        options - the new SSL options
      • updateSSLOptions

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Boolean> updateSSLOptions​(io.vertx.core.net.SSLOptions options,
                                                                boolean force)
        Like updateSSLOptions(io.vertx.core.net.SSLOptions) but supplying a handler that will be called when the update happened (or has failed).

        Unlike the bare Vert.x variant, this method returns a Uni. 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:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • updateSSLOptionsAndAwait

        public Boolean updateSSLOptionsAndAwait​(io.vertx.core.net.SSLOptions options,
                                                boolean force)
        Blocking variant of updateSSLOptions(SSLOptions,boolean).

        This method waits 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 Boolean instance produced by the operation.
      • updateSSLOptionsAndForget

        public void updateSSLOptionsAndForget​(io.vertx.core.net.SSLOptions options,
                                              boolean force)
        Variant of updateSSLOptions(SSLOptions,boolean) that ignores the result of the operation.

        This method subscribes on the result of updateSSLOptions(SSLOptions,boolean), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from updateSSLOptions(SSLOptions,boolean) but you don't need to compose it with other operations.

        Parameters:
        options - the new SSL options
        force - force the update when options are equals
      • close

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> close()
        Close the client. Closing will close down any pooled connections. Clients should always be closed after use.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • closeAndAwait

        public Void closeAndAwait()
        Blocking variant of close().

        This method waits 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).

        Returns:
        the Void instance produced by the operation.
      • closeAndForget

        public void closeAndForget()
        Variant of close() that ignores the result of the operation.

        This method subscribes on the result of close(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from close() but you don't need to compose it with other operations.

      • newInstance

        public static WebSocketClient newInstance​(io.vertx.core.http.WebSocketClient arg)