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

public Class WebSocket08FrameEncoder

extends MessageToMessageEncoder<WebSocketFrame>
implements WebSocketFrameEncoder
Class Inheritance
All Implemented Interfaces
io.netty.handler.codec.http.websocketx.WebSocketFrameEncoder, io.netty.channel.ChannelOutboundHandler, io.netty.channel.ChannelHandler
Known Direct Subclasses
io.netty.handler.codec.http.websocketx.WebSocket13FrameEncoder, io.netty.handler.codec.http.websocketx.WebSocket07FrameEncoder
Imports
io.netty.buffer.ByteBuf, io.netty.channel.ChannelHandlerContext, io.netty.handler.codec.MessageToMessageEncoder, .TooLongFrameException, io.netty.util.internal.PlatformDependent, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.nio.ByteOrder, java.util.List

Encodes a web socket frame into wire protocol version 8 format. This code was forked from webbit and modified.

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
WebSocket08FrameEncoder(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 an other one
msg
,
List<Object>
the List into which the encoded msg should be added needs to do some kind of aggregation
out
)

Implements abstract io.netty.handler.codec.MessageToMessageEncoder.encode.

Encode from one message to an other.
Inherited from io.netty.handler.codec.MessageToMessageEncoder:
acceptOutboundMessagewrite

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 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

WebSocket08FrameEncoderback to summary
public WebSocket08FrameEncoder(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

Implements abstract io.netty.handler.codec.MessageToMessageEncoder.encode.

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

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

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToMessageEncoder belongs to

msg:WebSocketFrame

the message to encode to an other one

out:List<Object>

the List into which the encoded msg should be added needs to do some kind of aggregation

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