Before the servlet dispatched the sse GET method in one thread like below code example, sse event sending to SseEventSink with POST method is already started in another thread.
The sequence like this:
- GET is called
- The user's get endpoint method is called and returns
- HTTP header OK for GET is flushed
- POST is called
- The user's post endpoint method is called and tries to write to the SSE sink
- When this GET method isn't dispatched completely (it doesn't reach this line:
server tries to write the event to SseSInk, and It breaks.