spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.32k stars 38.01k forks source link

Add support for SSE to WebMvc.fn #25920

Closed sdeleuze closed 3 years ago

sdeleuze commented 3 years ago

On Spring MVC with annotations, ResponseBodyEmitter return types (and its specialized variant SseEmitter) are used to emit streaming values. Currently WebMvc.fn has support for asynchronous single value but not for SSE. I am wondering if ServerResponse.async(Object asyncResponse) should be improved to support such use case.

Worth to notice, the emitter instance is designed to be passed to another component, see ResponseBodyEmitter Javadoc for more details.

poutsma commented 3 years ago

Currently WebMvc.fn has support for asynchronous single value but not for SSE.

Just so that other people reading this issue don't get confused: WebMvc.fn does support multiple values, in the form of a reactive streams Publisher.