diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/BlockingSender.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/BlockingSender.java deleted file mode 100644 index 0c17f66b7c968..0000000000000 --- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/BlockingSender.java +++ /dev/null @@ -1,72 +0,0 @@ -package io.quarkus.websockets.next; - -import io.smallrye.common.annotation.Experimental; -import io.vertx.core.buffer.Buffer; - -/** - * Sends messages to the connected WebSocket client and waits for the completion. - *
- * Note that blocking sender methods should never be called on an event loop thread.
- */
-@Experimental("This API is experimental and may change in the future")
-public interface BlockingSender extends Sender {
-
- /**
- * Sends a text message and waits for the completion.
- *
- * @param message
- */
- default void sendTextAndAwait(String message) {
- sendText(message).await().indefinitely();
- }
-
- /**
- * Sends a text message and waits for the completion.
- *
- * @param
- * 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.
- *
- * @param data May be at most 125 bytes
- */
- default void sendPongAndAwait(Buffer data) {
- sendPong(data).await().indefinitely();
- }
-}
diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/Connection.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/Connection.java
index 6a249c815a23c..1e772b34e4498 100644
--- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/Connection.java
+++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/Connection.java
@@ -11,7 +11,7 @@
* @see WebSocketConnection
* @see WebSocketClientConnection
*/
-public interface Connection extends BlockingSender {
+public interface Connection extends Sender {
/**
*
diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/Sender.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/Sender.java
index 577cf36c10ed5..b97535e5151fb 100644
--- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/Sender.java
+++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/Sender.java
@@ -6,7 +6,7 @@
import io.vertx.core.buffer.Buffer;
/**
- * Sends messages to the connected WebSocket client.
+ * Sends messages to the connected WebSocket client/server.
*/
@Experimental("This API is experimental and may change in the future")
public interface Sender {
@@ -20,16 +20,45 @@ public interface Sender {
@CheckReturnValue
Uni
+ * This method should never be called on an event loop thread.
+ *
+ * @param message
+ */
+ default void sendTextAndAwait(String message) {
+ sendText(message).await().indefinitely();
+ }
+
/**
* Send a text message.
+ *
+ * A {@link TextMessageCodec} is used to encode the message.
*
* @param
+ * A {@link TextMessageCodec} is used to encode the message.
+ *
+ * This method should never be called on an event loop thread.
+ *
+ * @param
+ * This method should never be called on an event loop thread.
+ *
+ * @param message
+ */
+ default void sendBinaryAndAwait(Buffer message) {
+ sendBinary(message).await().indefinitely();
+ }
+
/**
* Send a binary message.
*
@@ -50,6 +90,17 @@ default Uni
+ * This method should never be called on an event loop thread.
+ *
+ * @param message
+ */
+ default void sendBinaryAndAwait(byte[] message) {
+ sendBinary(message).await().indefinitely();
+ }
+
/**
* Send a ping message.
*
@@ -59,6 +110,17 @@ default Uni
+ * This method should never be called on an event loop thread.
+ *
+ * @param data May be at most 125 bytes
+ */
+ default void sendPingAndAwait(Buffer data) {
+ sendPing(data).await().indefinitely();
+ }
+
/**
* Send an unsolicited pong message.
*
@@ -72,4 +134,19 @@ default Uni
+ * 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.
+ *
+ * @param data May be at most 125 bytes
+ */
+ default void sendPongAndAwait(Buffer data) {
+ sendPong(data).await().indefinitely();
+ }
+
}
diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/WebSocketConnection.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/WebSocketConnection.java
index ea82ba5942b4d..2f243fe7a6d4d 100644
--- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/WebSocketConnection.java
+++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/WebSocketConnection.java
@@ -12,8 +12,7 @@
* endpoint and used to interact with the connected client, or all clients connected to the endpoint respectively
* (broadcasting).
*
- * Specifically, it is possible to send messages using blocking and non-blocking methods, declared on
- * {@link BlockingSender} and {@link Sender} respectively.
+ * Specifically, it is possible to send messages using blocking and non-blocking methods declared on {@link Sender}.
*/
@Experimental("This API is experimental and may change in the future")
public interface WebSocketConnection extends Connection {
@@ -51,7 +50,7 @@ public interface WebSocketConnection extends Connection {
*
* @see WebSocketConnection#getOpenConnections()
*/
- interface BroadcastSender extends BlockingSender {
+ interface BroadcastSender extends Sender {
/**
*