I'm coming across a issue when using stomp websocket. I'm using websocket to send image data, which may be large and beyond the sendBufferSizeLimit (which is 512*1024),and in SubProtocolWebSocketHandler, it will raise a SessionLimitExceededException and terminate the session. By reading the source code, I found that the strategy is defined in ConcurrentWebSocketSessionDecorator, whose overflowStrategy is OverflowStrategy.TERMINATE by default in its constructor. My question is, I want to switch the strategy to OverflowStrategy.DROP so that my session will not be terminated. However, I did not find the way to change the strategy, any idea?
Comment From: sbrannen
However, I did not find the way to change the strategy, any idea?
To change the strategy, create a subclass of SubProtocolWebSocketHandler
that overrides decorateSession(WebSocketSession)
and returns a new ConcurrentWebSocketSessionDecorator
using the constructor that accepts an OverflowStrategy
. That constructor was added in Spring Framework 5.1 exactly for this purpose. See #21677 for details.
In light of that, I am closing this issue.
Comment From: ronmate
@sbrannen @skaleto hi, thanks for posting this, and that's exactly what I need. However, after I created a subclass of SubProtocolWebSocketHandler , how do wire it to use the subclass?