Package io.quarkus.websockets.next
Annotation Interface OnOpen
@Retention(RUNTIME)
@Target(METHOD)
@Experimental("This API is experimental and may change in the future")
public @interface OnOpen
WebSocket and WebSocketClient endpoint methods annotated with this annotation are invoked when a new
connection is opened. An endpoint may declare at most one method annotated with this annotation.
Execution model
- Methods annotated with
RunOnVirtualThreadare considered blocking and should be executed on a virtual thread. - Methods annotated with
Blockingare considered blocking and should be executed on a worker thread. - Methods annotated with
NonBlockingare considered non-blocking and should be executed on an event loop thread.
- Methods returning
voidare considered blocking and should be executed on a worker thread. - Methods returning
UniorMultiare considered non-blocking and should be executed on an event loop thread. - Methods returning any other type are considered blocking and should be executed on a worker thread.
Method parameters
The method may accept the following parameters:WebSocketConnection/WebSocketClientConnection; depending on the endpoint typeHandshakeRequestStringparameters annotated withPathParam
-
Optional Element Summary
Optional Elements
-
Element Details
-
broadcast
boolean broadcastBroadcasting is only supported for server endpoints annotated withWebSocket.- Returns:
trueif all the connected clients should receive the objects emitted by the annotated method- See Also:
- Default:
- false
-