Details
Description
The JAX-RS SseEventSource can be closed by calling the close method. If this is done while the SseEventSource is in the middle of receiving an event then sometimes a partial event is delivered to the callback function.
This is clearly deliberate as seen in the source but it causes clients to receive invalid events.
For example if the server sends an event stream with the lines:
id: fizz name: buzz data: Some Data id: foo name: bar data: Some Other Data <EOF>
but the client is closed during the reception of the second event then the client may
receive an event with one of:
- Just an id and no name or data
- An id and name, but no data
- The complete event
This situation is not theoretical. The integration tests for my product have become unstable due to this behaviour, which I have to work around.
The correct behaviour would be to not send any pending but potentially incomplete event at the end of the stream. A valid event stream will always terminate with an empty line to indicate the end of the final event, so there should be no need for cleanup.
Attachments
Issue Links
- links to