Closed alpeshvasani closed 3 years ago
Your server probably has a limit on the size of the TextMessage/Buffer. What server are you connecting to?
@KammererTob The same message is working fine with this client - http://jxy.me/websocket-debug-tool/
I am using raw WebSocket tye of server connection.
Hey,
i've just tried it in the Dart VM with my Spring Server and it worked without problems. What does your server look like?
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/topic" , "/queue");
config.setApplicationDestinationPrefixes("/app");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws").setAllowedOrigins("*");
registry.addEndpoint("/ws").setAllowedOrigins("*").withSockJS();
}
@Override
public void configureWebSocketTransport(WebSocketTransportRegistration registration) {
registration.setSendBufferSizeLimit(20 * 1024 * 1024)
.setMessageSizeLimit(20 * 1024 * 1024);
}
}
@MessageMapping("/chat/send")
public ProjectChat processMessage(@Payload ProjectChat chatMessage) {
ProjectChat saved = new ProjectChat();
try {
} catch(Exception ex ) {
throw new RuntimeException("Exception while sending message over socket", ex);
}
return saved;
}
This works fine with a long base64 string on our web-based application, facing the issue with the Flutter Mobile Application.
Hey,
can you please enable trace logging for websocket on Spring. If you are using logback this can be configured inside the logback.xml. If you don't this probably also can be done inside the application properties:
<logger name="org.springframework.web.socket" level="TRACE"/>
Can you then please paste the output of the relevant part (if any) here? Thanks!
It's not reaching up to the server. The request gets closed from the Flutter side with no error/log.
Hey,
i've tested with flutter and my Spring server and the message gets thru once i define this @Bean (it is different from the one defined in your code):
@Bean
public ServletServerContainerFactoryBean createWebSocketContainer() {
ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
container.setMaxBinaryMessageBufferSize(32768);
container.setMaxTextMessageBufferSize(60000);
return container;
}
As of now, we have shifted the approach for sending base64 to a REST API. I will have someone check the @bean approach.
Thank you for your help @KammererTob
Alright. I will close this issue. Feel free to reopen if the Bean did not fix your problem.
any updates
Sending a message with base64 disconnects the connection and re-connect.
Logs -
Tried with the latest version i.e. 0.4.0 Please help!