Interface WsSession

All Known Implementing Classes:
ClientWsConnection, WsConnection

public interface WsSession
WebSocket session.
  • Method Details

    • send

      WsSession send(String text, boolean last)
      Send text fragment.
      Parameters:
      text - text to send
      last - if last fragment
      Returns:
      this instance
    • send

      WsSession send(BufferData bufferData, boolean last)
      Send binary fragment.
      Parameters:
      bufferData - buffer with data
      last - if last fragment
      Returns:
      this instance
    • ping

      WsSession ping(BufferData bufferData)
      Send ping.
      Parameters:
      bufferData - buffer with data
      Returns:
      this instance
    • pong

      WsSession pong(BufferData bufferData)
      Send pong.
      Parameters:
      bufferData - buffer with data
      Returns:
      this instance
    • close

      WsSession close(int code, String reason)
      Close session.
      Parameters:
      code - close code, may be one of WsCloseCodes
      reason - reason description
      Returns:
      this instance
    • terminate

      WsSession terminate()
      Terminate session. Sends a close and closes the connection.
      Returns:
      this instance
    • subProtocol

      default Optional<String> subProtocol()
      The WebSocket sub-protocol negotiated for this session.
      Returns:
      sub-protocol negotiated, if any
    • socketContext

      SocketContext socketContext()
      The underlying socket context.
      Returns:
      socket context