Class WebSocketConnectionBase

java.lang.Object
io.quarkus.websockets.next.runtime.WebSocketConnectionBase
All Implemented Interfaces:
Connection, Sender
Direct Known Subclasses:
WebSocketClientConnectionImpl, WebSocketConnectionImpl

public abstract class WebSocketConnectionBase extends Object implements Connection
  • Field Details

    • identifier

      protected final String identifier
    • pathParams

      protected final Map<String,String> pathParams
    • codecs

      protected final Codecs codecs
    • handshakeRequest

      protected final HandshakeRequest handshakeRequest
    • creationTime

      protected final Instant creationTime
    • trafficLogger

      protected final TrafficLogger trafficLogger
  • Constructor Details

  • Method Details

    • webSocket

      abstract io.vertx.core.http.WebSocketBase webSocket()
    • id

      public String id()
      Specified by:
      id in interface Connection
      Returns:
      the unique identifier assigned to this connection
    • pathParam

      public String pathParam(String name)
      Specified by:
      pathParam in interface Connection
      Parameters:
      name -
      Returns:
      the value of the path parameter or null
      See Also:
    • sendText

      public io.smallrye.mutiny.Uni<Void> sendText(String message)
      Description copied from interface: Sender
      Send a text message.
      Specified by:
      sendText in interface Sender
      Parameters:
      message -
      Returns:
      a new Uni with a null item
    • sendBinary

      public io.smallrye.mutiny.Uni<Void> sendBinary(io.vertx.core.buffer.Buffer message)
      Description copied from interface: Sender
      Send a binary message.
      Specified by:
      sendBinary in interface Sender
      Parameters:
      message -
      Returns:
      a new Uni with a null item
    • sendText

      public <M> io.smallrye.mutiny.Uni<Void> sendText(M message)
      Description copied from interface: Sender
      Send a text message.

      A TextMessageCodec is used to encode the message.

      Specified by:
      sendText in interface Sender
      Type Parameters:
      M -
      Parameters:
      message -
      Returns:
      a new Uni with a null item
      See Also:
    • sendPing

      public io.smallrye.mutiny.Uni<Void> sendPing(io.vertx.core.buffer.Buffer data)
      Description copied from interface: Sender
      Send a ping message.
      Specified by:
      sendPing in interface Sender
      Parameters:
      data - May be at most 125 bytes
      Returns:
      a new Uni with a null item
    • sendAutoPing

      void sendAutoPing()
    • sendPong

      public io.smallrye.mutiny.Uni<Void> sendPong(io.vertx.core.buffer.Buffer data)
      Description copied from interface: Sender
      Send an unsolicited pong message.

      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.

      Specified by:
      sendPong in interface Sender
      Parameters:
      data - May be at most 125 bytes
      Returns:
      a new Uni with a null item
    • close

      public io.smallrye.mutiny.Uni<Void> close()
      Description copied from interface: Connection
      Close the connection.
      Specified by:
      close in interface Connection
      Returns:
      a new Uni with a null item
    • close

      public io.smallrye.mutiny.Uni<Void> close(CloseReason reason)
      Description copied from interface: Connection
      Close the connection with a specific reason.
      Specified by:
      close in interface Connection
      Parameters:
      reason -
      Returns:
      a new Uni with a null item
    • isSecure

      public boolean isSecure()
      Specified by:
      isSecure in interface Connection
      Returns:
      true if the HTTP connection is encrypted via SSL/TLS
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface Connection
      Returns:
      true if the WebSocket is closed
    • handshakeRequest

      public HandshakeRequest handshakeRequest()
      Specified by:
      handshakeRequest in interface Connection
      Returns:
      the handshake request
    • creationTime

      public Instant creationTime()
      Specified by:
      creationTime in interface Connection
      Returns:
      the time when this connection was created
    • broadcast

    • closeReason

      public CloseReason closeReason()
      Specified by:
      closeReason in interface Connection
      Returns:
      the close reason or null if the connection is not closed
    • userData

      public UserData userData()
      Specified by:
      userData in interface Connection
      Returns:
      the user data associated with this connection