Improve docs and handling of send errors in ResponseBodyEmitter [SPR-16548] #21091
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: documentation
A documentation task
type: enhancement
A general enhancement
Milestone
Guido opened SPR-16548 and commented
Problem
When using SseEmitter and closing tabs in the browser, the
onComplete
andonError
callbacks are not called for every subscription.Code to subscribe:
Note that an SSE stream is not supposed to know when it is terminated. Only when a message fails to be sent, can the stream be closed. This is what I tried to do.
See below for the output log. I observe that when a
send
call fails, the SseEmitter is not terminated correctly. In addition, it's not possible to mark it as terminated by hand. ThecompleteWithError
call succeeds in one case and fails in another, but neither call seem to register with theonComplete
oronError
listeners.Is this a bug? What is the proper way to implement an SseEmitter?
Steps to reproduce
localhost:8088
in four tabs, then close the first threeResources
Issue Links:
Referenced from: commits 568c934, e206520
The text was updated successfully, but these errors were encountered: