- 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 TypeMethodDescriptionbooleanfin()Is the end of message (or end of continuation).default booleanHelper method to check whether this is a payload frame (text or binary), or a control frame (such as ping, pong, close etc.).booleanmasked()Whether this frame is masked.int[]Masking key, ifmasked()returnstrue.opCode()Operation code of this frame.Always unmasked.longLength of the payload bytes.
-
Method Details
-
fin
boolean fin()Is the end of message (or end of continuation).- Returns:
trueif 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:
truefor masked frames
-
payloadLength
long payloadLength()Length of the payload bytes.- Returns:
- payload length
-
maskingKey
int[] maskingKey()Masking key, ifmasked()returnstrue.- 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:
truefor text or binary frames,falsefor control frames- See Also:
-