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) ?
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.