xin.alum.aim.coder.WebEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aim-starter Show documentation
Show all versions of aim-starter Show documentation
aim-starter 基于netty的WebSocket和Socket通信包
package xin.alum.aim.coder;
import io.netty.util.ReferenceCountUtil;
import xin.alum.aim.config.DataAgreement;
import xin.alum.aim.constant.ChannelAttr;
import xin.alum.aim.model.Transportable;
import xin.alum.aim.util.JSONUtils;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import java.util.List;
public class WebEncoder extends MessageToMessageEncoder {
protected final InternalLogger logger =
InternalLoggerFactory.getInstance(this.getClass());
@Override
protected void encode(ChannelHandlerContext ctx, Transportable in, List