为了账号安全,请及时绑定邮箱和手机立即绑定

netty接收前端图片转成的base64时会报错

netty接收前端图片转成的base64时会报错

报的错误是:

io.netty.handler.codec.CorruptedFrameException: Max frame length of 65536 has been exceeded.

at io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder.protocolViolation(WebSocket08FrameDecoder.java:412)

at io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder.decode(WebSocket08FrameDecoder.java:277)

at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)

at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)

at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)

at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)

at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)

at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)

at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:647)

at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:582)

at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:499)

at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:461)

at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)

at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)

at java.lang.Thread.run(Unknown Source)

这个问题该怎么解决?

正在回答

2 回答

创建

WebSocketServerProtocolHandler

传入最大数

ch.pipeline().addLast(new WebSocketServerProtocolHandler("/send",null,false,1048576*2));


0 回复 有任何疑惑可以回复我~

怎么解决的?大佬

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

netty接收前端图片转成的base64时会报错

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信