Interface FrameHeader

All Known Implementing Classes:
FrameHeaderConsumer

interface FrameHeader
The FrameHeader represents the variable length header used for a WebSocket frame. It is used to determine the number of bytes that need to be consumed to successfully process a frame from the connected client.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    This provides the length of the payload within the frame.
    byte[]
    This provides the client mask send with the request.
    This is used to determine the type of frame.
    boolean
    This is used to determine if the frame is the final frame in a sequence of fragments or a whole frame.
    boolean
    This is used to determine if the frame is masked.
  • Method Details

    • getType

      FrameType getType()
      This is used to determine the type of frame. Interpretation of this type is outlined in RFC 6455 and can be loosely categorised as control frames and either data or binary frames.
      Returns:
      this returns the type of frame that this represents
    • getMask

      byte[] getMask()
      This provides the client mask send with the request. The mask is a 32 bit value that is used as an XOR bitmask of the client payload. Masking applies only in the client to server direction.
      Returns:
      this returns the 32 bit mask used for this frame
    • getLength

      int getLength()
      This provides the length of the payload within the frame. It is used to determine how much data to consume from the underlying TCP stream in order to recreate the frame to dispatch.
      Returns:
      the number of bytes used in the frame
    • isMasked

      boolean isMasked()
      This is used to determine if the frame is masked. All client frames should be masked according to RFC 6455. If masked the payload will have its contents bitmasked with a 32 bit value.
      Returns:
      this returns true if the payload has been masked
    • isFinal

      boolean isFinal()
      This is used to determine if the frame is the final frame in a sequence of fragments or a whole frame. If this returns false then the frame is a continuation from from a sequence of fragments, otherwise it is a whole frame or the last fragment.
      Returns:
      this returns false if the frame is a fragment