Top Description Fields Constructors Methods
io.netty5.handler.codec.http.websocketx

public Class WebSocket13FrameEncoder

extends MessageToMessageEncoder<WebSocketFrame>
implements WebSocketFrameEncoder
Class Inheritance
All Implemented Interfaces
io.netty5.handler.codec.http.websocketx.WebSocketFrameEncoder, io.netty5.channel.ChannelHandler
Imports
io.netty5.buffer.Buffer, io.netty5.channel.ChannelHandlerContext, io.netty5.handler.codec.MessageToMessageEncoder, .TooLongFrameException, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.util.List, java.util.concurrent.ThreadLocalRandom

Encodes a web socket frame into wire protocol version 13 format. V13 is essentially the same as V8.

Field Summary

Modifier and TypeField and Description
private static final int
GATHERING_WRITE_THRESHOLD

The size threshold for gathering writes.

private static final InternalLogger
private final boolean
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte

Constructor Summary

AccessConstructor and Description
public
WebSocket13FrameEncoder(boolean
Web socket clients must set this to true to mask payload. Server implementations must set this to false.
maskPayload
)

Constructor

Method Summary

Modifier and TypeMethod and Description
protected void
encode(ChannelHandlerContext ctx, WebSocketFrame
the message to encode to another one.
msg
,
List<Object>
the List into which produced output messages should be added.
out
)

Overrides io.netty5.handler.codec.MessageToMessageEncoder.encode.

Encode from one message to another.
Inherited from io.netty5.handler.codec.MessageToMessageEncoder:
acceptOutboundMessageencodeAndClosewrite

Field Detail

GATHERING_WRITE_THRESHOLDback to summary
private static final int GATHERING_WRITE_THRESHOLD

The size threshold for gathering writes. Non-Masked messages bigger than this size will be be sent fragmented as a header and a content ByteBuf whereas messages smaller than the size will be merged into a single buffer and sent at once.
Masked messages will always be sent at once.

loggerback to summary
private static final InternalLogger logger
maskPayloadback to summary
private final boolean maskPayload
OPCODE_BINARYback to summary
private static final byte OPCODE_BINARY
OPCODE_CLOSEback to summary
private static final byte OPCODE_CLOSE
OPCODE_CONTback to summary
private static final byte OPCODE_CONT
OPCODE_PINGback to summary
private static final byte OPCODE_PING
OPCODE_PONGback to summary
private static final byte OPCODE_PONG
OPCODE_TEXTback to summary
private static final byte OPCODE_TEXT

Constructor Detail

WebSocket13FrameEncoderback to summary
public WebSocket13FrameEncoder(boolean maskPayload)

Constructor

Parameters
maskPayload:boolean

Web socket clients must set this to true to mask payload. Server implementations must set this to false.

Method Detail

encodeback to summary
protected void encode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception

Overrides io.netty5.handler.codec.MessageToMessageEncoder.encode.

Doc from io.netty5.handler.codec.MessageToMessageEncoder.encode.

Encode from one message to another. This method will be called for each written message that can be handled by this encoder.

The message will be disposed of after this call.

Subclasses that wish to sometimes pass messages through, should instead override the encodeAndClose(ChannelHandlerContext, Object, List) method.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToMessageEncoder belongs to.

msg:WebSocketFrame

the message to encode to another one.

out:List<Object>

the List into which produced output messages should be added.

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs.