报错信息:
io.netty.handler.codec.CorruptedFrameException: Max frame length of 65536 has been exceeded.
解决:
public class Handler extends ChannelInitializer {
private final Service service = new Service();
@Override
protected void initChannel(Channel ch) throws Exception {
//两个小时没有客户端发送消息就发生心跳
ch.pipeline().addLast(new IdleStateHandler(60*60*2,0,0));
ch.pipeline().addLast(new HttpServerCodec());
ch.pipeline().addLast(new ChunkedWriteHandler());
ch.pipeline().addLast(new HttpObjectAggregator(100 * 1024 * 1024));
**ch.pipeline().addLast(new WebSocketServerProtocolHandler("/send",null,false,1048576*2));**
ch.pipeline().addLast(service);
}