diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/BinaryMessageCodec.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/BinaryMessageCodec.java index 2755e92239ed3..f6abc3b42b173 100644 --- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/BinaryMessageCodec.java +++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/BinaryMessageCodec.java @@ -6,8 +6,27 @@ /** * Used to encode and decode binary messages. * + *
+ *
*
- * An endpoint may declare at most one method annotated with this annotation.
*/
@Retention(RUNTIME)
@Target(METHOD)
diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnClose.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnClose.java
index 39ed396ec24ba..c5e1014acad0a 100644
--- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnClose.java
+++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnClose.java
@@ -10,9 +10,30 @@
/**
* {@link WebSocket} and {@link WebSocketClient} endpoint methods annotated with this annotation are invoked when a connection
- * is closed.
+ * is closed. An endpoint may declare at most one method annotated with this annotation. The method must return {@code void} or
+ * {@code io.smallrye.mutiny.Uni
- * The method must return {@code void} or {@code io.smallrye.mutiny.Uni
- * An endpoint may declare at most one method annotated with this annotation.
*/
@Retention(RUNTIME)
@Target(METHOD)
diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnError.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnError.java
index ee277a3373b71..4e2464ba2d485 100644
--- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnError.java
+++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnError.java
@@ -13,8 +13,32 @@
* occurs.
*
* It is used when an endpoint callback throws a runtime error, or when a conversion errors occurs, or when a returned
- * {@link io.smallrye.mutiny.Uni} receives a failure.
+ * {@link io.smallrye.mutiny.Uni} receives a failure. An endpoint may declare multiple methods annotated with this annotation.
+ * However, each method must declare a different error
+ * parameter. The method that declares a most-specific supertype of the actual exception is selected.
+ *
+ *
+ *
- * An endpoint may declare multiple methods annotated with this annotation. However, each method must declare a different error
- * parameter. The method that declares a most-specific supertype of the actual exception is selected.
- *
+ *
+ *
+ *
- * An endpoint may declare at most one method annotated with this annotation.
*/
@Retention(RUNTIME)
@Target(METHOD)
diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnPongMessage.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnPongMessage.java
index a1b077704fb94..4491ba0150a75 100644
--- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnPongMessage.java
+++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnPongMessage.java
@@ -9,7 +9,30 @@
import io.smallrye.common.annotation.Experimental;
/**
- * {@link WebSocket} and {@link WebSocketClient} endpoint methods annotated with this annotation consume pong messages.
+ * {@link WebSocket} and {@link WebSocketClient} endpoint methods annotated with this annotation consume pong messages. An
+ * endpoint may declare at most one method annotated with this annotation.
+ *
+ *
+ *
- * An endpoint may declare at most one method annotated with this annotation.
+ *
*/
@Retention(RUNTIME)
@Target(METHOD)
diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnTextMessage.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnTextMessage.java
index ac7cd56b27a42..8eab65d7977d9 100644
--- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnTextMessage.java
+++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnTextMessage.java
@@ -9,13 +9,37 @@
import io.smallrye.common.annotation.Experimental;
/**
- * {@link WebSocket} and {@link WebSocketClient} endpoint methods annotated with this annotation consume text messages.
+ * {@link WebSocket} and {@link WebSocketClient} endpoint methods annotated with this annotation consume text messages. An
+ * endpoint may declare at most one method annotated with this annotation.
+ *
+ *
+ *
*
+ *
* The method may also accept the following parameters:
*
- * An endpoint may declare at most one method annotated with this annotation.
*/
@Retention(RUNTIME)
@Target(METHOD)
diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/PathParam.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/PathParam.java
index 353e965e194bf..f49419909989e 100644
--- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/PathParam.java
+++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/PathParam.java
@@ -14,6 +14,8 @@
*
* @see WebSocketConnection#pathParam(String)
* @see WebSocket
+ * @see WebSocketClientConnection#pathParam(String)
+ * @see WebSocketClient
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/TextMessageCodec.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/TextMessageCodec.java
index 1146f686c3553..2ca9b73c2f44b 100644
--- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/TextMessageCodec.java
+++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/TextMessageCodec.java
@@ -5,8 +5,27 @@
/**
* Used to encode and decode text messages.
*
+ *
* An endpoint must declare a method annotated with {@link OnTextMessage}, {@link OnBinaryMessage}, {@link OnPongMessage} or
* {@link OnOpen}. An endpoint may declare a method annotated with {@link OnClose}.
Execution model
+ *
+ *
+ *
+ *
+ * Execution model for methods which don't declare any of the annotation listed above is derived from the return type:
*
+ *
+ *
+ * Method parameters
+ *
* The method may accept the following parameters:
*
*
* Note that it's not possible to send a message to the current connection as the socket is already closed when the method
* invoked. However, it is possible to send messages to other open connections.
- * Execution model
+ *
+ *
+ *
+ *
+ * Execution model for methods which don't declare any of the annotation listed above is derived from the return type:
*
+ *
+ *
+ * Method parameters
+ *
* The method must accept exactly one "error" parameter, i.e. a parameter that is assignable from {@link java.lang.Throwable}.
* The method may also accept the following parameters:
*
@@ -23,9 +47,9 @@
*
* Global error handlers
+ *
* This annotation can be also used to declare a global error handler, i.e. a method that is not declared on a
* {@link WebSocket}/{@link WebSocketClient} endpoint. Such a method may not accept {@link PathParam} paremeters. If a global
* error handler accepts {@link WebSocketConnection} then it's only applied to server-side errors. If a global error
diff --git a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnOpen.java b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnOpen.java
index 7489fb35c89ce..1ac5bd5afd274 100644
--- a/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnOpen.java
+++ b/extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/OnOpen.java
@@ -10,16 +10,36 @@
/**
* {@link WebSocket} and {@link WebSocketClient} endpoint methods annotated with this annotation are invoked when a new
- * connection is opened.
+ * connection is opened. An endpoint may declare at most one method annotated with this annotation.
+ *
+ * Execution model
+ *
+ *
+ *
+ *
+ * Execution model for methods which don't declare any of the annotation listed above is derived from the return type:
*
+ *
+ *
+ * Method parameters
+ *
* The method may accept the following parameters:
*
*
- * Execution model
+ *
+ *
+ *
+ *
+ * Execution model for methods which don't declare any of the annotation listed above is derived from the return type:
+ *
+ *
+ *
+ * Method parameters
*
* The method must accept exactly one pong message parameter represented as a {@link io.vertx.core.buffer.Buffer}. The method
* may also accept the following parameters:
@@ -19,7 +42,7 @@
* Execution model
+ *
+ *
+ *
+ *
+ * Execution model for methods which don't declare any of the annotation listed above is derived from the return type:
*
+ *
+ *
+ * Method parameters
+ *
* The method must accept exactly one message parameter. A text message is always represented as a {@link String}. Therefore,
- * the following conversion rules apply. The types listed
- * below are handled specifically. For all other types a {@link TextMessageCodec} is used to encode and decode input and
- * output messages. By default, the first input codec that supports the message type is used; codecs with higher priority go
- * first. However, a specific codec can be selected with {@link #codec()} and {@link #outputCodec()}.
+ * the following conversion rules apply. The types listed below are handled specifically. For all other types a
+ * {@link TextMessageCodec} is used to encode and decode input and output messages. By default, the first input codec that
+ * supports the message type is used; codecs with higher priority go first. However, a specific codec can be selected with
+ * {@link #codec()} and {@link #outputCodec()}.
+ *
*
- *
*
- * Special types of messages
+ *
+ * Some types of messages bypass the encoding/decoding process:
+ *
+ *
+ * The encoding/decoding details are described in {@link OnTextMessage}.
+ *
+ * CDI beans
+ * Implementation classes must be CDI beans. Qualifiers are ignored. {@link jakarta.enterprise.context.Dependent} beans are
+ * reused during encoding/decoding.
+ *
+ * Lifecycle and concurrency
+ * Codecs are shared accross all WebSocket connections. Therefore, implementations should be either stateless or thread-safe.
+ *
* @param