Interface WebSocketBase

    • Method Detail

      • write

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> write​(Buffer data)
        Same as but with an handler called when the operation completes

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

        Specified by:
        write in interface WriteStream<Buffer>
        Parameters:
        data -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • writeAndAwait

        Void writeAndAwait​(Buffer data)
        Blocking variant of io.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer).

        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).

        Specified by:
        writeAndAwait in interface WriteStream<Buffer>
        Parameters:
        data -
        Returns:
        the Void instance produced by the operation.
      • writeAndForget

        void writeAndForget​(Buffer data)
        Variant of io.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer) that ignores the result of the operation.

        This method subscribes on the result of io.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from io.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer) but you don't need to compose it with other operations.

        Specified by:
        writeAndForget in interface WriteStream<Buffer>
        Parameters:
        data -
      • end

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> end​(Buffer data)
        Same as but with an handler called when the operation completes

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

        Specified by:
        end in interface WriteStream<Buffer>
        Parameters:
        data -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • endAndAwait

        Void endAndAwait​(Buffer data)
        Blocking variant of io.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer).

        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).

        Specified by:
        endAndAwait in interface WriteStream<Buffer>
        Parameters:
        data -
        Returns:
        the Void instance produced by the operation.
      • endAndForget

        void endAndForget​(Buffer data)
        Variant of io.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer) that ignores the result of the operation.

        This method subscribes on the result of io.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from io.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer) but you don't need to compose it with other operations.

        Specified by:
        endAndForget in interface WriteStream<Buffer>
        Parameters:
        data -
      • pipeTo

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> pipeTo​(WriteStream<Buffer> dst)
        Pipe this ReadStream to the WriteStream.

        Elements emitted by this stream will be written to the write stream until this stream ends or fails.

        Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

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

        Specified by:
        pipeTo in interface ReadStream<Buffer>
        Parameters:
        dst - the destination write stream
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • setWriteQueueMaxSize

        WebSocketBase setWriteQueueMaxSize​(int maxSize)
        Specified by:
        setWriteQueueMaxSize in interface WriteStream<Buffer>
        Parameters:
        maxSize - the max size of the write stream
        Returns:
        a reference to this, so the API can be used fluently
      • binaryHandlerID

        String binaryHandlerID()
        Returns:
        the binary handler id
      • textHandlerID

        String textHandlerID()
        Returns:
      • subProtocol

        String subProtocol()
        Returns:
      • closeStatusCode

        Short closeStatusCode()
        Returns:
      • closeReason

        String closeReason()
        Returns:
      • headers

        MultiMap headers()
        Returns:
        the headers
      • writeFrame

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> writeFrame​(WebSocketFrame frame)
        Same as writeFrame(io.vertx.mutiny.core.http.WebSocketFrame) but with an handler called when the operation completes

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

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

        Void writeFrameAndAwait​(WebSocketFrame frame)
        Blocking variant of writeFrame(io.vertx.mutiny.core.http.WebSocketFrame).

        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:
        frame -
        Returns:
        the Void instance produced by the operation.
      • writeFinalTextFrame

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> writeFinalTextFrame​(String text)
        Same as writeFinalTextFrame(java.lang.String) but with an handler called when the operation completes

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

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

        Void writeFinalTextFrameAndAwait​(String text)
        Blocking variant of writeFinalTextFrame(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:
        text -
        Returns:
        the Void instance produced by the operation.
      • writeFinalTextFrameAndForget

        WebSocketBase writeFinalTextFrameAndForget​(String text)
        Variant of writeFinalTextFrame(String) that ignores the result of the operation.

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

        Parameters:
        text -
        Returns:
        the instance of WebSocketBase to chain method calls.
      • writeFinalBinaryFrame

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> writeFinalBinaryFrame​(Buffer data)
        Same as writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer) but with an handler called when the operation completes

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

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

        Void writeFinalBinaryFrameAndAwait​(Buffer data)
        Blocking variant of writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer).

        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:
        data -
        Returns:
        the Void instance produced by the operation.
      • writeBinaryMessage

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> writeBinaryMessage​(Buffer data)
        Same as writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer) but with an handler called when the operation completes

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

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

        Void writeBinaryMessageAndAwait​(Buffer data)
        Blocking variant of writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer).

        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:
        data -
        Returns:
        the Void instance produced by the operation.
      • writeTextMessage

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> writeTextMessage​(String text)
        Same as writeTextMessage(java.lang.String) but with an handler called when the operation completes

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

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

        Void writeTextMessageAndAwait​(String text)
        Blocking variant of writeTextMessage(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:
        text -
        Returns:
        the Void instance produced by the operation.
      • writeTextMessageAndForget

        WebSocketBase writeTextMessageAndForget​(String text)
        Variant of writeTextMessage(String) that ignores the result of the operation.

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

        Parameters:
        text -
        Returns:
        the instance of WebSocketBase to chain method calls.
      • writePing

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> writePing​(Buffer data)
        Writes a ping frame to the connection. This will be written in a single frame. Ping frames may be at most 125 bytes (octets).

        This method should not be used to write application data and should only be used for implementing a keep alive or to ensure the client is still responsive, see RFC 6455 Section section 5.5.2.

        There is no handler for ping frames because RFC 6455 clearly states that the only response to a ping frame is a pong frame with identical contents.

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

        Parameters:
        data - the data to write, may be at most 125 bytes
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • writePingAndAwait

        Void writePingAndAwait​(Buffer data)
        Blocking variant of writePing(io.vertx.mutiny.core.buffer.Buffer).

        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:
        data - the data to write, may be at most 125 bytes
        Returns:
        the Void instance produced by the operation.
      • writePong

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> writePong​(Buffer data)
        Writes a pong frame to the connection. This will be written in a single frame. Pong frames may be at most 125 bytes (octets).

        This method should not be used to write application data and should only be used for implementing a keep alive or to ensure the client is still responsive, see RFC 6455 section 5.5.2.

        There is no need to manually write a pong frame, as the server and client both handle responding to a ping from with a pong from automatically and this is exposed to users. RFC 6455 section 5.5.3 states that pongs may be sent unsolicited in order to implement a one way heartbeat.

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

        Parameters:
        data - the data to write, may be at most 125 bytes
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • writePongAndAwait

        Void writePongAndAwait​(Buffer data)
        Blocking variant of writePong(io.vertx.mutiny.core.buffer.Buffer).

        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:
        data - the data to write, may be at most 125 bytes
        Returns:
        the Void instance produced by the operation.
      • closeHandler

        WebSocketBase closeHandler​(Runnable handler)
        Parameters:
        handler - the handler
        Returns:
      • end

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> end()
        Calls close()

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

        Specified by:
        end in interface WriteStream<Buffer>
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • endAndAwait

        Void endAndAwait()
        Blocking variant of end(io.vertx.mutiny.core.buffer.Buffer).

        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).

        Specified by:
        endAndAwait in interface WriteStream<Buffer>
        Returns:
        the Void instance produced by the operation.
      • close

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> close()
        Same as close() but with an handler called when the operation completes

        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

        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

        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.

      • close

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> close​(short statusCode)
        Same as close() but with an handler called when the operation completes

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

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

        Void closeAndAwait​(short statusCode)
        Blocking variant of close(short).

        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:
        statusCode -
        Returns:
        the Void instance produced by the operation.
      • closeAndForget

        void closeAndForget​(short statusCode)
        Variant of close(short) that ignores the result of the operation.

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

        Parameters:
        statusCode -
      • close

        @CheckReturnValue
        io.smallrye.mutiny.Uni<Void> close​(short statusCode,
                                           String reason)
        Same as close() but with an handler called when the operation completes

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

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

        Void closeAndAwait​(short statusCode,
                           String reason)
        Blocking variant of close(short,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:
        statusCode -
        reason -
        Returns:
        the Void instance produced by the operation.
      • closeAndForget

        void closeAndForget​(short statusCode,
                            String reason)
        Variant of close(short,String) that ignores the result of the operation.

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

        Parameters:
        statusCode -
        reason -
      • remoteAddress

        SocketAddress remoteAddress()
        Returns:
        the remote address for this connection, possibly null (e.g a server bound on a domain socket). If useProxyProtocol is set to true, the address returned will be of the actual connecting client.
      • localAddress

        SocketAddress localAddress()
        Returns:
        the local address for this connection, possibly null (e.g a server bound on a domain socket) If useProxyProtocol is set to true, the address returned will be of the proxy.
      • isSsl

        boolean isSsl()
        Returns:
        true if this HttpConnection is encrypted via SSL/TLS.
      • isClosed

        boolean isClosed()
        Returns:
        true if the WebSocket is closed
      • sslSession

        SSLSession sslSession()
        Returns:
        SSLSession associated with the underlying socket. Returns null if connection is not SSL.
      • newInstance

        static WebSocketBase newInstance​(io.vertx.core.http.WebSocketBase arg)