Interface Sender

All Known Subinterfaces:
Connection, WebSocketClientConnection, WebSocketConnection, WebSocketConnection.BroadcastSender
All Known Implementing Classes:
WebSocketClientConnectionImpl, WebSocketConnectionBase, WebSocketConnectionImpl

public interface Sender
Sends messages to the connected WebSocket client/server.
  • Method Summary

    Modifier and Type
    Method
    Description
    default io.smallrye.mutiny.Uni<Void>
    sendBinary(byte[] message)
    Send a binary message.
    io.smallrye.mutiny.Uni<Void>
    sendBinary(io.vertx.core.buffer.Buffer message)
    Send a binary message.
    default void
    sendBinaryAndAwait(byte[] message)
    Sends a binary message and waits for the completion.
    default void
    sendBinaryAndAwait(io.vertx.core.buffer.Buffer message)
    Sends a binary message and waits for the completion.
    io.smallrye.mutiny.Uni<Void>
    sendPing(io.vertx.core.buffer.Buffer data)
    Send a ping message.
    default void
    sendPingAndAwait(io.vertx.core.buffer.Buffer data)
    Send a ping message and waits for the completion.
    io.smallrye.mutiny.Uni<Void>
    sendPong(io.vertx.core.buffer.Buffer data)
    Send an unsolicited pong message.
    default void
    sendPongAndAwait(io.vertx.core.buffer.Buffer data)
    Send an unsolicited pong message and waits for the completion.
    io.smallrye.mutiny.Uni<Void>
    sendText(String message)
    Send a text message.
    <M> io.smallrye.mutiny.Uni<Void>
    sendText(M message)
    Send a text message.
    default void
    Sends a text message and waits for the completion.
    default <M> void
    sendTextAndAwait(M message)
    Sends a text message and waits for the completion.
  • Method Details

    • sendText

      @CheckReturnValue io.smallrye.mutiny.Uni<Void> sendText(String message)
      Send a text message.
      Parameters:
      message -
      Returns:
      a new Uni with a null item
    • sendTextAndAwait

      default void sendTextAndAwait(String message)
      Sends a text message and waits for the completion.

      This method should never be called on an event loop thread.

      Parameters:
      message -
    • sendText

      @CheckReturnValue <M> io.smallrye.mutiny.Uni<Void> sendText(M message)
      Send a text message.

      A TextMessageCodec is used to encode the message.

      Type Parameters:
      M -
      Parameters:
      message -
      Returns:
      a new Uni with a null item
      See Also:
    • sendTextAndAwait

      default <M> void sendTextAndAwait(M message)
      Sends a text message and waits for the completion.

      A TextMessageCodec is used to encode the message.

      This method should never be called on an event loop thread.

      Type Parameters:
      M -
      Parameters:
      message -
      See Also:
    • sendBinary

      @CheckReturnValue io.smallrye.mutiny.Uni<Void> sendBinary(io.vertx.core.buffer.Buffer message)
      Send a binary message.
      Parameters:
      message -
      Returns:
      a new Uni with a null item
    • sendBinaryAndAwait

      default void sendBinaryAndAwait(io.vertx.core.buffer.Buffer message)
      Sends a binary message and waits for the completion.

      This method should never be called on an event loop thread.

      Parameters:
      message -
    • sendBinary

      @CheckReturnValue default io.smallrye.mutiny.Uni<Void> sendBinary(byte[] message)
      Send a binary message.
      Parameters:
      message -
      Returns:
      a new Uni with a null item
    • sendBinaryAndAwait

      default void sendBinaryAndAwait(byte[] message)
      Sends a binary message and waits for the completion.

      This method should never be called on an event loop thread.

      Parameters:
      message -
    • sendPing

      @CheckReturnValue io.smallrye.mutiny.Uni<Void> sendPing(io.vertx.core.buffer.Buffer data)
      Send a ping message.
      Parameters:
      data - May be at most 125 bytes
      Returns:
      a new Uni with a null item
    • sendPingAndAwait

      default void sendPingAndAwait(io.vertx.core.buffer.Buffer data)
      Send a ping message and waits for the completion.

      This method should never be called on an event loop thread.

      Parameters:
      data - May be at most 125 bytes
    • sendPong

      @CheckReturnValue io.smallrye.mutiny.Uni<Void> sendPong(io.vertx.core.buffer.Buffer data)
      Send an unsolicited pong message.

      Note that the server automatically responds to a ping message sent from the client. However, the RFC 6455 section 5.5.3 states that unsolicited pong may serve as a unidirectional heartbeat.

      Parameters:
      data - May be at most 125 bytes
      Returns:
      a new Uni with a null item
    • sendPongAndAwait

      default void sendPongAndAwait(io.vertx.core.buffer.Buffer data)
      Send an unsolicited pong message and waits for the completion.

      This method should never be called on an event loop thread.

      Note that the server automatically responds to a ping message sent from the client. However, the RFC 6455 section 5.5.3 states that unsolicited pong may serve as a unidirectional heartbeat.

      Parameters:
      data - May be at most 125 bytes