The documentation is not clear how to set the max frame payload size, all questions are pointing to cloud gateway. Currently we are not using gateway and just using rsocker server. Thanks

Comment From: rstoyanchev

@philwebb I think this relates entirely to Spring Boot where the RSocket server is configured and started.

@srinivasvsk I'm not sure if your goal is to fragment large RSocket Payloads, or to limit the frame size at the WebSocket transport level? For the former you can set RSocketServer#fragment via RSocketServerCustomizer. For the latter you'd need to customize RSocket's WebsocketServerTransport. In the upcoming RSocket Java 1.1 there is a convenient method to do this but in RSocket 1.0.x you'd have to override the start method. In either case, however I don't see any option to customize the transport in Boot which is created privately in NettyRSocketServerFactory.

Comment From: srinivasvsk

Thanks for more details, my use case is to pass a large payload, process and stream results back. Had the server complained about 6500 limit. can you point to more information on RSocketServerCustomizer

Comment From: bclozel

@srinivasvsk I guess you're referring to 65536 default limit on the websocket frame payload length - see reactor.netty.http.websocket.WebsocketSpec. I think Rossen was pointing out at another configuration, which is about the maximum inbound payload size on the server (which is at Integer.MAX_VALUE, see io.rsocket.core.RSocketServer.

For your current application, you'll need override the start method for your server and create your own server bean unfortunately. The RSocketServerCustomizer cannot help you here.

Spring Boot 2.4 will be based on RSocket Java 1.1 and Spring Boot could provide a callback to customize the chosen transport mechanism thanks to the new convenient method.

After this discussion, I'm re-transferring this issue to Spring Boot and re-purposing it to "Allow RSocket transport customization".

Thanks!

Comment From: rstoyanchev

@bclozel yes one option is to increase the WebSocket frame size at the transport level in Reactor Netty. Isn't it also an option to enable fragmentation of large Payload's at the RSocket level via RSocketServerCustomizer? That would get the Payload through as well without changing the WebSocket frame size.

Comment From: bclozel

Right!

@srinivasvsk

In the meantime, you can declare an RSocketServerCustomizer in your Spring Boot application like this:

@Configuration(proxyBeanMethods = false)
public class RSocketConfig {

  @Bean
  public RSocketServerCustomizer fragmentationCustomizer() {
    return (server) -> server.fragment(16384); // use a non-zero value that tells the server to fragment messages at this size
    // you should use a value that's not too small to avoid overhead, but not larger than the `65536` websocket max frame size
  }

}

Comment From: srinivasvsk

Great thank you all