Class WebSocket

    • Constructor Detail

      • WebSocket

        public WebSocket​(io.vertx.core.http.WebSocket delegate)
    • Method Detail

      • hashCode

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

        public 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 WebSocketBase
        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

        public 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 WebSocketBase
        Specified by:
        endAndAwait in interface WriteStream<Buffer>
        Parameters:
        data -
        Returns:
        the Void instance produced by the operation
      • pipeTo

        public 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>
        Specified by:
        pipeTo in interface WebSocketBase
        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

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

        public WebSocketBase writePing​(Buffer data)
        Specified by:
        writePing in interface WebSocketBase
        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

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

        public io.smallrye.mutiny.Uni<Void> end()
        Calls WebSocketBase.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 WebSocketBase
        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.
      • close

        public io.smallrye.mutiny.Uni<Void> close()
        Same as WebSocketBase.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.

        Specified by:
        close in interface WebSocketBase
        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 WebSocketBase.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).

        Specified by:
        closeAndAwait in interface WebSocketBase
        Returns:
        the Void instance produced by the operation
      • close

        public io.smallrye.mutiny.Uni<Void> close​(short statusCode)
        Same as WebSocketBase.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.

        Specified by:
        close in interface WebSocketBase
        Parameters:
        statusCode -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • closeAndAwait

        public Void closeAndAwait​(short statusCode)
        Blocking variant of WebSocketBase.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).

        Specified by:
        closeAndAwait in interface WebSocketBase
        Parameters:
        statusCode -
        Returns:
        the Void instance produced by the operation
      • close

        public io.smallrye.mutiny.Uni<Void> close​(short statusCode,
                                                  String reason)
        Same as WebSocketBase.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.

        Specified by:
        close in interface WebSocketBase
        Parameters:
        statusCode -
        reason -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • closeAndAwait

        public Void closeAndAwait​(short statusCode,
                                  String reason)
        Blocking variant of WebSocketBase.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).

        Specified by:
        closeAndAwait in interface WebSocketBase
        Parameters:
        statusCode -
        reason -
        Returns:
        the Void instance produced by the operation
      • remoteAddress

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

        public SocketAddress localAddress()
        Specified by:
        localAddress in interface WebSocketBase
        Returns:
        the local address for this connection, possibly null (e.g a server bound on a domain socket)
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface WebSocketBase
        Returns:
        true if the WebSocket is closed
      • write

        public 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 WebSocketBase
        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

        public 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 WebSocketBase
        Specified by:
        writeAndAwait in interface WriteStream<Buffer>
        Returns:
        the Void instance produced by the operation
      • writeFinalTextFrame

        public io.smallrye.mutiny.Uni<Void> writeFinalTextFrame​(String text)
        Description copied from interface: WebSocketBase
        Same as WebSocketBase.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.

        Specified by:
        writeFinalTextFrame in interface WebSocketBase
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • writeFinalTextFrameAndAwait

        public Void writeFinalTextFrameAndAwait​(String text)
        Description copied from interface: WebSocketBase
        Blocking variant of WebSocketBase.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).

        Specified by:
        writeFinalTextFrameAndAwait in interface WebSocketBase
        Returns:
        the Void instance produced by the operation
      • writeTextMessage

        public io.smallrye.mutiny.Uni<Void> writeTextMessage​(String text)
        Description copied from interface: WebSocketBase
        Same as WebSocketBase.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.

        Specified by:
        writeTextMessage in interface WebSocketBase
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • writeTextMessageAndAwait

        public Void writeTextMessageAndAwait​(String text)
        Description copied from interface: WebSocketBase
        Blocking variant of WebSocketBase.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).

        Specified by:
        writeTextMessageAndAwait in interface WebSocketBase
        Returns:
        the Void instance produced by the operation
      • sslSession

        public SSLSession sslSession()
        Specified by:
        sslSession in interface WebSocketBase
        Returns:
        SSLSession associated with the underlying socket. Returns null if connection is not SSL.
      • endAndForget

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

        Parameters:
        data - the data to write
      • pipeToAndForget

        public void pipeToAndForget​(WriteStream<Buffer> dst)
        Variant of io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream) that ignores the result of the operation.

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

        Parameters:
        dst -
      • closeAndForget

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

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

      • closeAndForget

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

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

        Parameters:
        statusCode - Status code
      • writeFinalTextFrameAndForget

        public WebSocket writeFinalTextFrameAndForget​(String text)
      • writeFinalBinaryFrameAndForget

        public WebSocket writeFinalBinaryFrameAndForget​(Buffer data)
      • writeBinaryMessageAndForget

        public WebSocket writeBinaryMessageAndForget​(Buffer data)
      • writeTextMessageAndForget

        public WebSocket writeTextMessageAndForget​(String text)
      • toBlockingStream

        public Stream<Buffer> toBlockingStream()
      • newInstance

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