This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The two things I see in every SSE example: | |
@GET @Produces(MediaType.SERVER_SENT_EVENTS) | |
public void eventStream(@Context SseEventSink eventSink, @Context Sse sse) { | |
// starting a separate thread to handle the complete request within | |
// the context of the method | |
executor.execute(() -> { | |
// try-with-resources: closing the resource also in the method | |
try(SseEventSink sink = eventSink) { |