Interface WebSocketBase

    • Method Detail

      • end

        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
      • pipeTo

        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.
      • pipeToAndAwait

        Void pipeToAndAwait​(WriteStream<Buffer> dst)
        Blocking variant of io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream).

        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:
        pipeToAndAwait in interface ReadStream<Buffer>
        Parameters:
        dst - the destination write stream
        Returns:
        the Void instance produced by the operation
      • write

        io.smallrye.mutiny.Uni<Void> write​(Buffer data)
        Description copied from interface: WriteStream
        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>
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • writeAndAwait

        Void writeAndAwait​(Buffer data)
        Description copied from interface: WriteStream
        Blocking variant of io.vertx.mutiny.core.streams.WriteStream#write(T).

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

        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

        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
      • writeFinalBinaryFrame

        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

        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

        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
      • writePing

        WebSocketBase writePing​(Buffer data)
        Parameters:
        data - the data to write, may be at most 125 bytes
        Returns:
        a reference to this, so the API can be used fluently
      • writePong

        WebSocketBase writePong​(Buffer data)
        Parameters:
        data - the data to write, may be at most 125 bytes
        Returns:
        a reference to this, so the API can be used fluently
      • closeHandler

        WebSocketBase closeHandler​(Consumer<Void> handler)
        Parameters:
        handler - the handler
        Returns:
        a reference to this, so the API can be used fluently
      • frameHandler

        WebSocketBase frameHandler​(Consumer<WebSocketFrame> handler)
        Parameters:
        handler - the handler
        Returns:
        a reference to this, so the API can be used fluently
      • textMessageHandler

        WebSocketBase textMessageHandler​(Consumer<String> handler)
        Parameters:
        handler - the handler
        Returns:
        a reference to this, so the API can be used fluently
      • binaryMessageHandler

        WebSocketBase binaryMessageHandler​(Consumer<Buffer> handler)
        Parameters:
        handler - the handler
        Returns:
        a reference to this, so the API can be used fluently
      • pongHandler

        WebSocketBase pongHandler​(Consumer<Buffer> handler)
        Parameters:
        handler - the handler
        Returns:
        a reference to this, so the API can be used fluently
      • end

        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

        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
      • close

        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
      • close

        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
      • remoteAddress

        SocketAddress remoteAddress()
        Returns:
        the remote address for this connection, possibly null (e.g a server bound on a domain socket)
      • localAddress

        SocketAddress localAddress()
        Returns:
        the local address for this connection, possibly null (e.g a server bound on a domain socket)
      • 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)