Let users control SSE stream completion
This commit avoid merging automatically the SSE stream with Flux.never(). Since browsers automatically reconnect when the HTTP connection is closed, it is now the user responsability to optionally perform a concatWith(Flux.never()) on streams that complete in order to avoid receiving the data multiple times on client side. The behavior with hot streams that never complete does not change. Issue: SPR-14578
This commit is contained in:
@@ -79,10 +79,6 @@ public class ServerSentEventHttpMessageWriter implements HttpMessageWriter<Objec
|
||||
DataBufferFactory bufferFactory = outputMessage.bufferFactory();
|
||||
Flux<Publisher<DataBuffer>> body = encode(inputStream, bufferFactory, type);
|
||||
|
||||
// Keep the SSE connection open even for cold stream in order to avoid
|
||||
// unexpected browser reconnection
|
||||
body = body.concatWith(Flux.never());
|
||||
|
||||
return outputMessage.writeAndFlushWith(body);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user