We have a Spring backend Application with Angular Frontend.
When sending msgs from backend to frontend, some large msgs (size ard 80 - 125KB) are not being delivered. When i cut down the incoming object and make it smaller (mostly <64KB) it gets delivered.
@stomp/rx-stomp library is being used to send websocket msgs to backend. Here are some relevant configurations
export const myRxStompConfig: RxStompConfig = {
webSocketFactory: () => {
return new SockJS('/api/process/websocket');
},
logRawCommunication: false,
splitLargeFrames: true,
maxWebSocketChunkSize: 8 * 1024,
}
Here are some relevant configurations on backend side
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void configureWebSocketTransport(WebSocketTransportRegistration registry){
registry.setMessageSizeLimit(8192 * 1024); // default : 64 * 1024
registry.setSendTimeLimit(20 * 10000); // default : 10 * 10000
registry.setSendBufferSizeLimit(10 * 512 * 1024); // default : 512 * 1024
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/websocket").setAllowedOriginPatterns("*").withSockJS()
.setStreamBytesLimit(1024*1024);
}
}
Comment From: sdeleuze
Please provide a reproducer as an attached archive or a link to a repository, with instruction on how to reproduce.
Comment From: injae-kim
When sending msgs from backend to frontend, some large msgs (size ard 80 - 125KB) are not being delivered. When i cut down the incoming object and make it smaller (mostly <64KB) it gets delivered.
Hi @insuresense! I think this issue will be fixed soon my PR https://github.com/spring-projects/spring-framework/pull/31970.
Currently, spring-framwork's WebSocketStompClient
doesn't support to send large messages.
So large message that exceed 64KB
(default size limit of web socket) is not delivered well now.
But with my PR https://github.com/spring-projects/spring-framework/pull/31970, I fix WebSocketStompClient
to split large stomp message into multiple frames and send it.
"Receiving theses split multiple frames and reassemble to complete frame" is usually implemented well on stomp libraries (spring-framework also implements this receiving part well), so I think this issue will be fixed soon~! thanks! 😄
Comment From: injae-kim
https://stackoverflow.com/questions/34343235/stomp-spring-websocket-message-exceeds-size-limit
For workaround, I think you can increase limit size of web socket message like above~!
Comment From: sdeleuze
I think this issue will be fixed soon my PR https://github.com/spring-projects/spring-framework/pull/31970.
If that's the case, we should close this issue as a duplicate of https://github.com/spring-projects/spring-framework/pull/31970, right?
Comment From: injae-kim
If that's the case, we should close this issue as a duplicate of https://github.com/spring-projects/spring-framework/pull/31970, right?
Yes it's correct! cause this issue will be automatically fixed by #31970.