java.lang.Object
io.helidon.websocket.ServerWsFrame
- All Implemented Interfaces:
WsFrame
Frame from a server (never masked).
-
Method Summary
Modifier and TypeMethodDescriptionstatic ServerWsFramecontrol(WsOpCode opCode, BufferData bufferData) Create a new control frame.static ServerWsFramedata(BufferData bufferData, boolean last) Create a binary data frame.static ServerWsFrameCreate a text data frame.booleanfin()Is the end of message (or end of continuation).booleanHelper method to check whether this is a payload frame (text or binary), or a control frame (such as ping, pong, close etc.).protected static booleanisPayload(io.helidon.websocket.AbstractWsFrame.FrameHeader header) booleanmasked()Whether this frame is masked.int[]Masking key, ifWsFrame.masked()returnstrue.opCode()Operation code of this frame.voidConfigure the operation code of this frame.Always unmasked.longLength of the payload bytes.static ServerWsFrameread(SocketContext ctx, DataReader dataReader, int maxFrameLength) Read server frame from request data.protected static io.helidon.websocket.AbstractWsFrame.FrameHeaderreadFrameHeader(DataReader reader, int maxFrameLength) protected static BufferDatareadPayload(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 server 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 server frame
-
control
Create a new control frame.- Parameters:
opCode- operation code of this framebufferData- data of the frame, maximally 125 bytes- Returns:
- a new server frame
- Throws:
IllegalArgumentException- in case the length is invalid
-
read
Read server 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 server frame
- Throws:
WsCloseException- in case of invalid frameRuntimeException- depending on implementation of dataReader
-
masked
public boolean masked()Description copied from interface:WsFrameWhether this frame is masked. Server frames must not be masked, client frames must be masked.- Returns:
truefor masked frames
-
maskingKey
public int[] maskingKey()Description copied from interface:WsFrameMasking key, ifWsFrame.masked()returnstrue.- Returns:
- masking key if available
-
fin
public boolean fin()Description copied from interface:WsFrameIs the end of message (or end of continuation). -
opCode
Description copied from interface:WsFrameOperation code of this frame. -
payloadLength
public long payloadLength()Description copied from interface:WsFrameLength of the payload bytes.- Specified by:
payloadLengthin interfaceWsFrame- Returns:
- payload length
-
payloadData
Description copied from interface:WsFrameAlways unmasked.- Specified by:
payloadDatain interfaceWsFrame- Returns:
- payload bytes
-
isPayload
public boolean isPayload()Description copied from interface:WsFrameHelper 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)
-