Class ServerWebSocket

java.lang.Object
io.vertx.mutiny.core.http.ServerWebSocket
All Implemented Interfaces:
io.smallrye.mutiny.vertx.MutinyDelegate, WebSocketBase, ReadStream<Buffer>, StreamBase, WriteStream<Buffer>

public class ServerWebSocket extends Object implements io.smallrye.mutiny.vertx.MutinyDelegate, WebSocketBase
Represents a server side WebSocket.

Instances of this class are passed into a HttpServer.webSocketHandler(java.util.function.Consumer<io.vertx.mutiny.core.http.ServerWebSocket>) or provided when a WebSocket handshake is manually HttpServerRequest.toWebSocket()ed.

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

  • Field Details

    • __TYPE_ARG

      public static final io.smallrye.mutiny.vertx.TypeArg<ServerWebSocket> __TYPE_ARG
  • Constructor Details

    • ServerWebSocket

      public ServerWebSocket(io.vertx.core.http.ServerWebSocket delegate)
    • ServerWebSocket

      public ServerWebSocket(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.core.http.ServerWebSocket getDelegate()
      Specified by:
      getDelegate in interface io.smallrye.mutiny.vertx.MutinyDelegate
      Specified by:
      getDelegate in interface ReadStream<Buffer>
      Specified by:
      getDelegate in interface StreamBase
      Specified by:
      getDelegate in interface WebSocketBase
      Specified by:
      getDelegate in interface WriteStream<Buffer>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

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

      @CheckReturnValue public io.smallrye.mutiny.vertx.WriteStreamSubscriber<Buffer> toSubscriber()
    • write

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

      public Void writeAndAwait(Buffer data)
      Blocking variant of
      invalid reference
      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 WebSocketBase
      Specified by:
      writeAndAwait in interface WriteStream<Buffer>
      Parameters:
      data -
      Returns:
      the Void instance produced by the operation.
    • writeAndForget

      public void writeAndForget(Buffer data)
      Variant of
      invalid reference
      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

      invalid reference
      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
      invalid reference
      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 WebSocketBase
      Specified by:
      writeAndForget in interface WriteStream<Buffer>
      Parameters:
      data -
    • end

      @CheckReturnValue 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
      invalid reference
      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.
    • endAndForget

      public void endAndForget(Buffer data)
      Variant of
      invalid reference
      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

      invalid reference
      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
      invalid reference
      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 WebSocketBase
      Specified by:
      endAndForget in interface WriteStream<Buffer>
      Parameters:
      data -
    • writeQueueFull

      public boolean writeQueueFull()
      Specified by:
      writeQueueFull in interface WebSocketBase
      Specified by:
      writeQueueFull in interface WriteStream<Buffer>
      Returns:
      true if write queue is full
    • pipe

      public Pipe<Buffer> pipe()
      Specified by:
      pipe in interface ReadStream<Buffer>
      Specified by:
      pipe in interface WebSocketBase
      Returns:
      a pipe
    • pipeTo

      @CheckReturnValue 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 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.
    • pipeToAndForget

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

      This method subscribes on the result of 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 ReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream) but you don't need to compose it with other operations.

      Specified by:
      pipeToAndForget in interface ReadStream<Buffer>
      Specified by:
      pipeToAndForget in interface WebSocketBase
      Parameters:
      dst - the destination write stream
    • binaryHandlerID

      public String binaryHandlerID()
      Specified by:
      binaryHandlerID in interface WebSocketBase
      Returns:
      the binary handler id
    • textHandlerID

      public String textHandlerID()
      Specified by:
      textHandlerID in interface WebSocketBase
      Returns:
      the text handler id
    • subProtocol

      public String subProtocol()
      Specified by:
      subProtocol in interface WebSocketBase
      Returns:
    • closeStatusCode

      public Short closeStatusCode()
      Specified by:
      closeStatusCode in interface WebSocketBase
      Returns:
    • closeReason

      public String closeReason()
      Specified by:
      closeReason in interface WebSocketBase
      Returns:
    • headers

      public MultiMap headers()
      Specified by:
      headers in interface WebSocketBase
      Returns:
      the headers
    • textMessageHandler

      public WebSocketBase textMessageHandler(Consumer<String> handler)
      Specified by:
      textMessageHandler in interface WebSocketBase
      Parameters:
      handler - the handler
      Returns:
    • binaryMessageHandler

      public WebSocketBase binaryMessageHandler(Consumer<Buffer> handler)
      Specified by:
      binaryMessageHandler in interface WebSocketBase
      Parameters:
      handler - the handler
      Returns:
    • pongHandler

      public WebSocketBase pongHandler(Consumer<Buffer> handler)
      Specified by:
      pongHandler in interface WebSocketBase
      Parameters:
      handler - the handler
      Returns:
    • end

      @CheckReturnValue 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.
    • endAndAwait

      public Void endAndAwait()
      Blocking variant of WebSocketBase.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>
      Returns:
      the Void instance produced by the operation.
    • endAndForget

      public void endAndForget()
      Variant of WebSocketBase.end(io.vertx.mutiny.core.buffer.Buffer) that ignores the result of the operation.

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

      Specified by:
      endAndForget in interface WebSocketBase
      Specified by:
      endAndForget in interface WriteStream<Buffer>
    • close

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

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

      Specified by:
      closeAndForget in interface WebSocketBase
    • close

      @CheckReturnValue 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.
    • 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.

      Specified by:
      closeAndForget in interface WebSocketBase
      Parameters:
      statusCode -
    • close

      @CheckReturnValue 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.
    • closeAndForget

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

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

      Specified by:
      closeAndForget in interface WebSocketBase
      Parameters:
      statusCode -
      reason -
    • 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). If useProxyProtocol is set to true, the address returned will be of the actual connecting client.
    • 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) If useProxyProtocol is set to true, the address returned will be of the proxy.
    • isSsl

      public boolean isSsl()
      Specified by:
      isSsl in interface WebSocketBase
      Returns:
      true if this HttpConnection is encrypted via SSL/TLS.
    • isClosed

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

      public ServerWebSocket exceptionHandler(Consumer<Throwable> handler)
      Specified by:
      exceptionHandler in interface ReadStream<Buffer>
      Specified by:
      exceptionHandler in interface StreamBase
      Specified by:
      exceptionHandler in interface WebSocketBase
      Specified by:
      exceptionHandler in interface WriteStream<Buffer>
      Parameters:
      handler - the exception handler
      Returns:
    • handler

      public ServerWebSocket handler(Consumer<Buffer> handler)
      Specified by:
      handler in interface ReadStream<Buffer>
      Specified by:
      handler in interface WebSocketBase
      Parameters:
      handler -
      Returns:
    • pause

      public ServerWebSocket pause()
      Specified by:
      pause in interface ReadStream<Buffer>
      Specified by:
      pause in interface WebSocketBase
      Returns:
      a reference to this, so the API can be used fluently
    • resume

      public ServerWebSocket resume()
      Specified by:
      resume in interface ReadStream<Buffer>
      Specified by:
      resume in interface WebSocketBase
      Returns:
      a reference to this, so the API can be used fluently
    • fetch

      public ServerWebSocket fetch(long amount)
      Specified by:
      fetch in interface ReadStream<Buffer>
      Specified by:
      fetch in interface WebSocketBase
      Parameters:
      amount -
      Returns:
      a reference to this, so the API can be used fluently
    • endHandler

      public ServerWebSocket endHandler(Runnable endHandler)
      Specified by:
      endHandler in interface ReadStream<Buffer>
      Specified by:
      endHandler in interface WebSocketBase
      Parameters:
      endHandler -
      Returns:
    • setWriteQueueMaxSize

      public ServerWebSocket setWriteQueueMaxSize(int maxSize)
      Specified by:
      setWriteQueueMaxSize in interface WebSocketBase
      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
    • drainHandler

      public ServerWebSocket drainHandler(Runnable handler)
      Specified by:
      drainHandler in interface WebSocketBase
      Specified by:
      drainHandler in interface WriteStream<Buffer>
      Parameters:
      handler - the handler
      Returns:
    • writeFrame

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> writeFrame(WebSocketFrame frame)
      Description copied from interface: WebSocketBase
      Same as WebSocketBase.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.

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

      public Void writeFrameAndAwait(WebSocketFrame frame)
      Description copied from interface: WebSocketBase
      Blocking variant of WebSocketBase.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).

      Specified by:
      writeFrameAndAwait in interface WebSocketBase
      Parameters:
      frame -
      Returns:
      the Void instance produced by the operation.
    • writeFrameAndForget

      public ServerWebSocket writeFrameAndForget(WebSocketFrame frame)
      Description copied from interface: WebSocketBase
      Variant of WebSocketBase.writeFrame(io.vertx.mutiny.core.http.WebSocketFrame) that ignores the result of the operation.

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

      Specified by:
      writeFrameAndForget in interface WebSocketBase
      Parameters:
      frame -
      Returns:
      the instance of WebSocketBase to chain method calls.
    • writeFinalTextFrame

      @CheckReturnValue 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
      Parameters:
      text -
      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
      Parameters:
      text -
      Returns:
      the Void instance produced by the operation.
    • writeFinalTextFrameAndForget

      public ServerWebSocket writeFinalTextFrameAndForget(String text)
      Description copied from interface: WebSocketBase
      Variant of WebSocketBase.writeFinalTextFrame(String) that ignores the result of the operation.

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

      Specified by:
      writeFinalTextFrameAndForget in interface WebSocketBase
      Parameters:
      text -
      Returns:
      the instance of WebSocketBase to chain method calls.
    • writeFinalBinaryFrame

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> writeFinalBinaryFrame(Buffer data)
      Description copied from interface: WebSocketBase
      Same as WebSocketBase.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.

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

      public Void writeFinalBinaryFrameAndAwait(Buffer data)
      Description copied from interface: WebSocketBase
      Blocking variant of WebSocketBase.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).

      Specified by:
      writeFinalBinaryFrameAndAwait in interface WebSocketBase
      Parameters:
      data -
      Returns:
      the Void instance produced by the operation.
    • writeFinalBinaryFrameAndForget

      public ServerWebSocket writeFinalBinaryFrameAndForget(Buffer data)
      Description copied from interface: WebSocketBase
      Variant of WebSocketBase.writeFinalBinaryFrame(io.vertx.mutiny.core.buffer.Buffer) that ignores the result of the operation.

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

      Specified by:
      writeFinalBinaryFrameAndForget in interface WebSocketBase
      Parameters:
      data -
      Returns:
      the instance of WebSocketBase to chain method calls.
    • writeBinaryMessage

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> writeBinaryMessage(Buffer data)
      Description copied from interface: WebSocketBase
      Same as WebSocketBase.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.

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

      public Void writeBinaryMessageAndAwait(Buffer data)
      Description copied from interface: WebSocketBase
      Blocking variant of WebSocketBase.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).

      Specified by:
      writeBinaryMessageAndAwait in interface WebSocketBase
      Parameters:
      data -
      Returns:
      the Void instance produced by the operation.
    • writeBinaryMessageAndForget

      public ServerWebSocket writeBinaryMessageAndForget(Buffer data)
      Description copied from interface: WebSocketBase
      Variant of WebSocketBase.writeBinaryMessage(io.vertx.mutiny.core.buffer.Buffer) that ignores the result of the operation.

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

      Specified by:
      writeBinaryMessageAndForget in interface WebSocketBase
      Parameters:
      data -
      Returns:
      the instance of WebSocketBase to chain method calls.
    • writeTextMessage

      @CheckReturnValue 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
      Parameters:
      text -
      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
      Parameters:
      text -
      Returns:
      the Void instance produced by the operation.
    • writeTextMessageAndForget

      public ServerWebSocket writeTextMessageAndForget(String text)
      Description copied from interface: WebSocketBase
      Variant of WebSocketBase.writeTextMessage(String) that ignores the result of the operation.

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

      Specified by:
      writeTextMessageAndForget in interface WebSocketBase
      Parameters:
      text -
      Returns:
      the instance of WebSocketBase to chain method calls.
    • writePing

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> writePing(Buffer data)
      Description copied from interface: WebSocketBase
      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.

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

      public Void writePingAndAwait(Buffer data)
      Description copied from interface: WebSocketBase
      Blocking variant of WebSocketBase.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).

      Specified by:
      writePingAndAwait in interface WebSocketBase
      Parameters:
      data - the data to write, may be at most 125 bytes
      Returns:
      the Void instance produced by the operation.
    • writePingAndForget

      public ServerWebSocket writePingAndForget(Buffer data)
      Description copied from interface: WebSocketBase
      Variant of WebSocketBase.writePing(io.vertx.mutiny.core.buffer.Buffer) that ignores the result of the operation.

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

      Specified by:
      writePingAndForget in interface WebSocketBase
      Parameters:
      data - the data to write, may be at most 125 bytes
      Returns:
      the instance of WebSocketBase to chain method calls.
    • writePong

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> writePong(Buffer data)
      Description copied from interface: WebSocketBase
      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.

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

      public Void writePongAndAwait(Buffer data)
      Description copied from interface: WebSocketBase
      Blocking variant of WebSocketBase.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).

      Specified by:
      writePongAndAwait in interface WebSocketBase
      Parameters:
      data - the data to write, may be at most 125 bytes
      Returns:
      the Void instance produced by the operation.
    • writePongAndForget

      public ServerWebSocket writePongAndForget(Buffer data)
      Description copied from interface: WebSocketBase
      Variant of WebSocketBase.writePong(io.vertx.mutiny.core.buffer.Buffer) that ignores the result of the operation.

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

      Specified by:
      writePongAndForget in interface WebSocketBase
      Parameters:
      data - the data to write, may be at most 125 bytes
      Returns:
      the instance of WebSocketBase to chain method calls.
    • closeHandler

      public ServerWebSocket closeHandler(Runnable handler)
      Specified by:
      closeHandler in interface WebSocketBase
      Parameters:
      handler - the handler
      Returns:
    • frameHandler

      public ServerWebSocket frameHandler(Consumer<WebSocketFrame> handler)
      Specified by:
      frameHandler in interface WebSocketBase
      Parameters:
      handler - the handler
      Returns:
    • scheme

      public String scheme()
      Returns:
      the WebSocket handshake scheme
    • host

      @Deprecated public String host()
      Deprecated.
      use authority() instead
      Returns:
      the WebSocket handshake host
    • authority

      public HostAndPort authority()
      Returns:
      the WebSocket handshake authority
    • uri

      public String uri()
    • path

      public String path()
      Returns:
      the WebSocket handshake path.
    • query

      public String query()
      Returns:
      the WebSocket handshake query string.
    • accept

      @Deprecated public void accept()
      Deprecated.
    • reject

      @Deprecated public void reject()
      Deprecated.
    • reject

      @Deprecated public void reject(int status)
      Deprecated.
      Parameters:
      status -
    • setHandshake

      @CheckReturnValue @Deprecated public io.smallrye.mutiny.Uni<Integer> setHandshake(io.smallrye.mutiny.Uni<Integer> future)
      Deprecated.
      Set an asynchronous result for the handshake, upon completion of the specified future, the WebSocket will either be
      • accepted when the future succeeds with the HTTP status code
      • rejected when the future is succeeds with an HTTP status code different than
      • rejected when the future fails with the HTTP status code 500
      The provided future might be completed by the WebSocket itself, e.g calling the close() method will try to accept the handshake and close the WebSocket afterward. Thus it is advised to try to complete the future with or .

      This method should be called from the WebSocket handler to explicitly set an asynchronous handshake.

      Calling this method will override the future completion handler.

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

      Parameters:
      future - the future to complete with
      Returns:
      the uni firing the result of the operation when completed, or a failure if the operation failed.
    • setHandshakeAndAwait

      @Deprecated public Integer setHandshakeAndAwait(io.smallrye.mutiny.Uni<Integer> future)
      Deprecated.
      Blocking variant of
      invalid reference
      io.vertx.mutiny.core.http.ServerWebSocket#setHandshake(Future)
      .

      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:
      future - the future to complete with
      Returns:
      the Integer instance produced by the operation.
    • setHandshakeAndForget

      @Deprecated public void setHandshakeAndForget(io.smallrye.mutiny.Uni<Integer> future)
      Deprecated.
      Variant of
      invalid reference
      io.vertx.mutiny.core.http.ServerWebSocket#setHandshake(Future)
      that ignores the result of the operation.

      This method subscribes on the result of

      invalid reference
      io.vertx.mutiny.core.http.ServerWebSocket#setHandshake(Future)
      , but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from
      invalid reference
      io.vertx.mutiny.core.http.ServerWebSocket#setHandshake(Future)
      but you don't need to compose it with other operations.
      Parameters:
      future - the future to complete with
    • sslSession

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

      @CheckReturnValue public io.smallrye.mutiny.Multi<Buffer> toMulti()
      Specified by:
      toMulti in interface ReadStream<Buffer>
    • toBlockingIterable

      public Iterable<Buffer> toBlockingIterable()
    • toBlockingStream

      public Stream<Buffer> toBlockingStream()
    • newInstance

      public static ServerWebSocket newInstance(io.vertx.core.http.ServerWebSocket arg)