powered by Jive Software

Websocket plugin MessageTooLargeException

I’m trying to send 50kb groupchat message connected by websoсket, it causes this error.

Can I somehow to change buffers sizes or other ways to fix this??

2016.06.04 19:22:44 org.jivesoftware.openfire.websocket.XmppWebSocket - Error detected; session: WebSocketSession[websocket=JettyAnnotatedEventDriver[org.jivesoftware.openfire. websocket.XmppWebSocket@7da445],behavior=SERVER,connection=WebSocketServerConnec tion@1cd4bf9{FILLING}{f=Flusher[queueSize=0,aggregateSize=0,failure=null],g=Gene rator[SERVER,validating,+rsv1],p=Parser@1bdcac[ExtensionStack,s=START,c=0,len=52 596,f=TEXT[len=0,fin=false,rsv=1…,masked=true],p=WebSocketPolicy@1878804[behavi or=SERVER,maxTextMessageSize=65536,maxTextMessageBufferSize=32768,maxBinaryMessa geSize=65536,maxBinaryMessageBufferSize=32768,asyncWriteTimeout=60000,idleTimeou t=300000,inputBufferSize=4096]]},remote=WebSocketRemoteEndpoint@e1467d[batching= true],incoming=JettyAnnotatedEventDriver[org.jivesoftware.openfire.websocket.Xmp pWebSocket@7da445],outgoing=ExtensionStack[queueSize=0,extensions=[permessage-de flate],incoming=org.eclipse.jetty.websocket.common.extensions.compress.PerMessag eDeflateExtension,outgoing=org.eclipse.jetty.websocket.common.extensions.compres s.PerMessageDeflateExtension]]

org.eclipse.jetty.websocket.api.MessageTooLargeException: Frame is too large

at org.eclipse.jetty.websocket.common.extensions.compress.ByteAccumulator.addChunk (ByteAccumulator.java:43)

at org.eclipse.jetty.websocket.common.extensions.compress.CompressExtension.decomp ress(CompressExtension.java:166)

at org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtensi on.incomingFrame(PerMessageDeflateExtension.java:78)

at org.eclipse.jetty.websocket.common.extensions.ExtensionStack.incomingFrame(Exte nsionStack.java:214)

at org.eclipse.jetty.websocket.common.Parser.notifyFrame(Parser.java:220)

at org.eclipse.jetty.websocket.common.Parser.parse(Parser.java:258)

at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.readParse(Abs tractWebSocketConnection.java:628)

at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(Ab stractWebSocketConnection.java:476)

at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635 )

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)

at java.lang.Thread.run(Thread.java:745)

Fixed by adding this code into WebSocketPlugin.java method configure(WebSocketServletFactory factory):

WebSocketPolicy policy = factory.getPolicy();
policy.setMaxBinaryMessageBufferSize(131072);
policy.setMaxBinaryMessageSize(262144);
policy.setMaxTextMessageBufferSize(131072);
policy.setMaxTextMessageSize(262144);