0

Currently the only serialization of text/event-stream is done via ServerSentEventHttpMessageWriter. Is it possible to provide your own writer to change the way the data is serialized (providing a different format besides the SSE format) ?

user1568967
  • 1,816
  • 2
  • 16
  • 18

1 Answers1

1

You can add custom codecs and message readers/writers with a webflux @Configuration class; add something like this to your Spring Boot application:

@Configuration
public class MyConfiguration implements WebFluxConfigurer {

    @Override
    public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) {
        configurer.customCodecs().writer(customHttpMessageWriter);
    }
}

The javadoc for ServerCodecConfigurer, CodecConfigurer (and its inner interfaces) should be useful as well.

Brian Clozel
  • 56,583
  • 15
  • 167
  • 176