Search code examples
websocketmicronaut

Micronaut web socket client: max frame length exceeded


I am using the built-in web socket client (@ClientWebSocket) from the micronaut framework. When consuming big messages the client fails and terminates the connection. Following error is thrown:

17:59:47.153 [nioEventLoopGroup-1-2] ERROR i.m.h.c.w.NettyWebSocketClientHandler - Unexpected Exception in WebSocket [my.package.WebSocket$Intercepted@79698b5f]: Max frame length of 65536 has been exceeded.
io.netty.handler.codec.http.websocketx.CorruptedWebSocketFrameException: Max frame length of 65536 has been exceeded.

Is there a way to increase the max frame length or skip messages that are too long? I tried to set max-frame-length in the application.yml but that did not work.


Solution

  • The max frame length is configurable via the OnMessage annotation. See https://docs.micronaut.io/latest/api/io/micronaut/websocket/annotation/OnMessage.html#maxPayloadLength--