Interface WsFrame

All Known Implementing Classes:
ClientWsFrame, ServerWsFrame

public interface WsFrame
WebSocket frame. A frame represents single message from WebSocket client or server.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    fin()
    Is the end of message (or end of continuation).
    default boolean
    Helper method to check whether this is a payload frame (text or binary), or a control frame (such as ping, pong, close etc.).
    boolean
    Whether this frame is masked.
    int[]
    Masking key, if masked() returns true.
    Operation code of this frame.
    Always unmasked.
    long
    Length of the payload bytes.
  • Method Details

    • fin

      boolean fin()
      Is the end of message (or end of continuation).
      Returns:
      true if this is a full message, or the last message in a continuation
    • opCode

      WsOpCode opCode()
      Operation code of this frame.
      Returns:
      code of this frame
    • masked

      boolean masked()
      Whether this frame is masked. Server frames must not be masked, client frames must be masked.
      Returns:
      true for masked frames
    • payloadLength

      long payloadLength()
      Length of the payload bytes.
      Returns:
      payload length
    • maskingKey

      int[] maskingKey()
      Masking key, if masked() returns true.
      Returns:
      masking key if available
      Throws:
      IllegalStateException - if this frame is not masked
    • payloadData

      BufferData payloadData()
      Always unmasked.
      Returns:
      payload bytes
    • isPayload

      default boolean isPayload()
      Helper method to check whether this is a payload frame (text or binary), or a control frame (such as ping, pong, close etc.).
      Returns:
      true for text or binary frames, false for control frames
      See Also: