Package io.quarkus.websockets.next
Interface WebSocketConnection
- All Superinterfaces:
Connection,Sender
- All Known Implementing Classes:
WebSocketConnectionImpl
This interface represents a connection from a client to a specific
WebSocket endpoint on the server.
Quarkus provides a CDI bean that implements this interface and can be injected in a WebSocket
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 Sender.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceMakes it possible to send messages to all clients connected to the same WebSocket endpoint. -
Method Summary
Modifier and TypeMethodDescriptionSends messages to all open clients connected to the same WebSocket endpoint.The returned set also includes the connection this method is called upon.Methods inherited from interface io.quarkus.websockets.next.Connection
close, close, closeAndAwait, closeAndAwait, closeReason, creationTime, handshakeRequest, id, isClosed, isOpen, isSecure, pathParam, userDataMethods inherited from interface io.quarkus.websockets.next.Sender
sendBinary, sendBinary, sendBinaryAndAwait, sendBinaryAndAwait, sendPing, sendPingAndAwait, sendPong, sendPongAndAwait, sendText, sendText, sendTextAndAwait, sendTextAndAwait
-
Method Details
-
endpointId
String endpointId()- Returns:
- the endpoint id
- See Also:
-
broadcast
WebSocketConnection.BroadcastSender broadcast()Sends messages to all open clients connected to the same WebSocket endpoint.- Returns:
- the broadcast sender
- See Also:
-
getOpenConnections
Set<WebSocketConnection> getOpenConnections()The returned set also includes the connection this method is called upon.- Returns:
- the set of open connections to the same endpoint
-
subprotocol
String subprotocol()- Returns:
- the subprotocol selected by the handshake
-