public class WebSocket08FrameEncoder extends OneToOneEncoder
Encodes a web socket frame into wire protocol version 8 format. This code was forked from webbit and modified.
ChannelHandler.Sharable| Modifier and Type | Field and Description |
|---|---|
private static InternalLogger |
logger |
private boolean |
maskPayload |
private static byte |
OPCODE_BINARY |
private static byte |
OPCODE_CLOSE |
private static byte |
OPCODE_CONT |
private static byte |
OPCODE_PING |
private static byte |
OPCODE_PONG |
private static byte |
OPCODE_TEXT |
| Constructor and Description |
|---|
WebSocket08FrameEncoder(boolean maskPayload)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
encode(ChannelHandlerContext ctx,
Channel channel,
java.lang.Object msg)
Transforms the specified message into another message and return the
transformed message.
|
doEncode, handleDownstreamprivate static final InternalLogger logger
private static final byte OPCODE_CONT
private static final byte OPCODE_TEXT
private static final byte OPCODE_BINARY
private static final byte OPCODE_CLOSE
private static final byte OPCODE_PING
private static final byte OPCODE_PONG
private final boolean maskPayload
public WebSocket08FrameEncoder(boolean maskPayload)
maskPayload - Web socket clients must set this to true to mask payload. Server implementations must set this to
false.protected java.lang.Object encode(ChannelHandlerContext ctx, Channel channel, java.lang.Object msg) throws java.lang.Exception
OneToOneEncodernull, unlike
you can in OneToOneDecoder.decode(ChannelHandlerContext, Channel, Object);
you must return something, at least ChannelBuffers.EMPTY_BUFFER.encode in class OneToOneEncoderjava.lang.Exception