-
Bug
-
Resolution: Done
-
Critical
-
4.0.0.Beta2, 3.5.0.Final
-
None
-
None
SseBroadcaster has option to call onClose() callback:
"Register a listener, which will be called when the SSE event output has been closed (either by client closing the connection or by calling SseEventSink.close() on the server side. "
1) Client registers into broadcaster, opens the connection and sends requests for the event. Event is sent and broadcaster is closed with broadcaster.close() --> This works onClose() is called
Test: https://github.com/resteasy/Resteasy/pull/1433/files#diff-9dd4255c27f8bcf5707772f9c25f6634R128
2) Client registers into broadcaster, opens the connection and sends requests for the event.
The broadcaster automatically closes the SseEventSink after message is sent.
According to javadoc onClose() should be called when sinks closed. --> This doesn't work onClose() is not called
@POST @Path("/startAndClose") public void broadcastAndClose(String message, @Context Sse sse, @Context SseEventSink sseEventSink) throws IOException { if (this.sseBroadcaster == null) { throw new IllegalStateException("No Sse broadcaster created."); } this.sseBroadcaster.broadcast(sse.newEvent(message)).thenAccept((Object obj) -> { sseEventSink.close(); }); }
Test: https://github.com/resteasy/Resteasy/pull/1433/files#diff-9dd4255c27f8bcf5707772f9c25f6634R167
3) Client registers into broadcaster, opens the connection and sends requests for the event. Event is send by server. After the client connection is closed check if the onClose()
has been called. --> This doesn't work onClose() is not called
Test: https://github.com/resteasy/Resteasy/pull/1433/files#diff-9dd4255c27f8bcf5707772f9c25f6634R205
- is related to
-
RESTEASY-1680 SSE implementation
- Closed
- relates to
-
RESTEASY-1793 SseBroadcasterImpl does not follow the javadoc requirements
- Resolved