Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large size Websocket over Stomp (with Sockjs) Messages not getting delivered #31901

Closed
insuresense opened this issue Dec 24, 2023 · 5 comments
Closed
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue

Comments

@insuresense
Copy link

insuresense commented Dec 24, 2023

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);
	}
}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 24, 2023
@sdeleuze
Copy link
Contributor

sdeleuze commented Jan 2, 2024

Please provide a reproducer as an attached archive or a link to a repository, with instruction on how to reproduce.

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label Jan 2, 2024
@jhoeller jhoeller added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Jan 3, 2024
@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Jan 9, 2024
@injae-kim
Copy link
Contributor

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 #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 #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! 😄

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Jan 15, 2024
@injae-kim
Copy link
Contributor

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~!

@sdeleuze
Copy link
Contributor

I think this issue will be fixed soon my PR #31970.

If that's the case, we should close this issue as a duplicate of #31970, right?

@sdeleuze sdeleuze added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Jan 15, 2024
@injae-kim
Copy link
Contributor

injae-kim commented Jan 15, 2024

If that's the case, we should close this issue as a duplicate of #31970, right?

Yes it's correct! cause this issue will be automatically fixed by #31970.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jan 15, 2024
@sdeleuze sdeleuze added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Jan 15, 2024
@sdeleuze sdeleuze closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

5 participants