STOMP Spring WebSocket message exceeds size limit

Consider <websocket:transport message-size=""/> option for the <websocket:message-broker> definition:

Configure the maximum size for an incoming sub-protocol message. For example a STOMP message may be received as multiple WebSocket messages or multiple HTTP POST requests when SockJS fallback options are in use.

The same can be achieved in annotation configuration using WebSocketMessageBrokerConfigurer.configureWebSocketTransport(WebSocketTransportRegistration) implementation and with the setMessageSizeLimit() on the matter.


I was getting similar javascript errorr when the default value of 65kb was set.. then i set it to some random and again got some error like the

connection was interrupted

. So tried increasing the time limit and that worked for me. Actually when the limit exceeds, the messages are sent into packets/or frames, and while it was receiving the response from server, it timed out.

You can use tweak it as below

@EnableWebSocketMessageBroker
public class AppWebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
----
---
    @Override
        public void configureWebSocketTransport(WebSocketTransportRegistration registration) {
            registration.setMessageSizeLimit(200000); // default : 64 * 1024
            registration.setSendTimeLimit(20 * 10000); // default : 10 * 10000
            registration.setSendBufferSizeLimit(3* 512 * 1024); // default : 512 * 1024

        }
---
}