mvm
mvm

Reputation: 303

Websocket max frame length of 65536 has been exceeded

In my scala application I use web sockets to get requests and send responses. When I try to pass a base64 string through web sockets following exception occurs

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

I tried the below solution to fix my issue

export SBT_OPTS="-Xms1024m -Xmx3084m -XX:MaxPermSize=1024m -Dhttp.netty.maxInitialLineLength=2621440"

It works well in the Mac OS. But when I try the same solution in my windows(changed export to set) and Ubuntu machine it doesn't work. I get the same exception message. Please help me to fix this issue. Thanks in advance

Upvotes: 6

Views: 10156

Answers (3)

khacsinhcs
khacsinhcs

Reputation: 179

In my case, I create AsyncHttpClient manually. So I just set config

httpClient = new DefaultAsyncHttpClient(new DefaultAsyncHttpClientConfig.Builder()
    .setMaxRequestRetry(0)
    .setWebSocketMaxBufferSize(1024000)
    .setWebSocketMaxFrameSize(1024000).build());

If you create this obj by Injector, then add

play.websocket.buffer.limit=2621440

into application.conf.

Upvotes: 0

SKK
SKK

Reputation: 1719

The Default buffer size set for web socket is "65536". So you should increase the websocket buffer size in the application.conf file.

You can set the limit as given below.

play.websocket.buffer.limit=2621440

Upvotes: 7

Takahiko Kawasaki
Takahiko Kawasaki

Reputation: 19001

Find a way to increase the maximum size of WebSocket frames. For example, in Java, Session.setMaxTextMessageBufferSize(int) and Session.setMaxBinaryMessageBufferSize(int).

Upvotes: 4

Related Questions