Skip to content

Conversation

@co42
Copy link

@co42 co42 commented Nov 25, 2025

Motivation

Since https://github.com/tokio-rs/axum/releases/tag/axum-v0.8.5 SSE events with empty data are sent without a data field.

Event::default().event("deleted").data("")

Before :

event: deleted
data: 

After

event: deleted

According to https://html.spec.whatwg.org/multipage/server-sent-events.html (I did not found an RFC)

If the data buffer is an empty string, set the data buffer and the event type buffer to the empty string and return.

Which means these events are ignored (if I understand it correctly).

Before this change the SSE client I use was receiving the event, it does not anymore.

More context : jpopesculian/eventsource-stream#6

Solution

Write empty data field if set to an empty string as before.

Signed-off-by: Corentin REGAL <corentin@huggingface.co>
@jplatte
Copy link
Member

jplatte commented Dec 25, 2025

Seems likely to be related to #3154, any thoughts @nanoqsh / @mladedav?

@co42
Copy link
Author

co42 commented Feb 3, 2026

Can it be merged ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants