java.lang.Object
io.helidon.websocket.ClientWsFrame
- All Implemented Interfaces:
WsFrame
Frame from a client (always masked).
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClientWsFrame
control
(WsOpCode opCode, BufferData bufferData) Create a new control frame.static ClientWsFrame
data
(BufferData bufferData, boolean last) Create a binary data frame.static ClientWsFrame
Create a text data frame.boolean
fin()
Is the end of message (or end of continuation).boolean
Helper method to check whether this is a payload frame (text or binary), or a control frame (such as ping, pong, close etc.).protected static boolean
isPayload
(io.helidon.websocket.AbstractWsFrame.FrameHeader header) boolean
masked()
Whether this frame is masked.Masked data of this frame, to be sent over the network.int[]
Masking key, ifWsFrame.masked()
returnstrue
.opCode()
Operation code of this frame.void
Configure the operation code of this frame.Always unmasked.long
Length of the payload bytes.static ClientWsFrame
read
(SocketContext ctx, DataReader dataReader, int maxFrameLength) Read client frame from request data.protected static io.helidon.websocket.AbstractWsFrame.FrameHeader
readFrameHeader
(DataReader reader, int maxFrameLength) protected static BufferData
readPayload
(DataReader reader, io.helidon.websocket.AbstractWsFrame.FrameHeader header) toString()
-
Method Details
-
data
Create a text data frame. This method does not split the message into smaller frames if the number of bytes is too high, make sure to use with buffer sizes that are guaranteed to be processed by clients.- Parameters:
text
- text data contentlast
- whether the data is last- Returns:
- a new client frame
-
data
Create a binary data frame. This method does not split the message into smaller frames if the number of bytes is too high, make sure to use with buffer sizes that are guaranteed to be processed by clients.- Parameters:
bufferData
- binary data contentlast
- whether the data is last- Returns:
- a new client frame
-
control
Create a new control frame.- Parameters:
opCode
- operation code of this framebufferData
- data of the frame, maximally 125 bytes- Returns:
- a new client frame
- Throws:
IllegalArgumentException
- in case the length is invalid
-
read
Read client frame from request data.- Parameters:
ctx
- socket contextdataReader
- data reader to get frame bytes frommaxFrameLength
- maximal length of a frame, to protect memory from too big frames- Returns:
- a new client frame
- Throws:
WsCloseException
- in case of invalid frameRuntimeException
- depending on implementation of dataReader
-
masked
public boolean masked()Description copied from interface:WsFrame
Whether this frame is masked. Server frames must not be masked, client frames must be masked.- Returns:
true
for masked frames
-
maskingKey
public int[] maskingKey()Description copied from interface:WsFrame
Masking key, ifWsFrame.masked()
returnstrue
.- Returns:
- masking key if available
-
maskedData
Masked data of this frame, to be sent over the network.- Returns:
- masked data
-
fin
public boolean fin()Description copied from interface:WsFrame
Is the end of message (or end of continuation). -
opCode
Description copied from interface:WsFrame
Operation code of this frame. -
payloadLength
public long payloadLength()Description copied from interface:WsFrame
Length of the payload bytes.- Specified by:
payloadLength
in interfaceWsFrame
- Returns:
- payload length
-
payloadData
Description copied from interface:WsFrame
Always unmasked.- Specified by:
payloadData
in interfaceWsFrame
- Returns:
- payload bytes
-
isPayload
public boolean isPayload()Description copied from interface:WsFrame
Helper method to check whether this is a payload frame (text or binary), or a control frame (such as ping, pong, close etc.). -
opCode
Configure the operation code of this frame.- Parameters:
opCode
- code to use
-
toString
-
readFrameHeader
protected static io.helidon.websocket.AbstractWsFrame.FrameHeader readFrameHeader(DataReader reader, int maxFrameLength) -
readPayload
protected static BufferData readPayload(DataReader reader, io.helidon.websocket.AbstractWsFrame.FrameHeader header) -
isPayload
protected static boolean isPayload(io.helidon.websocket.AbstractWsFrame.FrameHeader header)
-