Interface WebSocketConnection

All Superinterfaces:
Connection, Sender
All Known Implementing Classes:
WebSocketConnectionImpl

public interface WebSocketConnection extends Connection
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.

  • Method Details

    • endpointId

      String endpointId()
      Returns:
      the endpoint id
      See Also:
    • 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