Windmill SSE response format — emit one item per event?
Hi,
I’m trying to use Server-Sent Events (SSE) with streamed responses in a script, but the Windmill SSE endpoint appears to “flush” multiple items into a single event. That doesn’t match the per-item yield format I expect.
My main scenario uses the ai-sdk tooling for streaming. Here’s a simplified example:
A sample response from the Windmill SSE endpoint (attached) looks like this:
However, I need one JSON object per SSE event because I iterate over each item. The expected output would be:
is there a way for formating like that?
5 Replies
By the way, my windmill version is CE v1.558.1
can't you simply split on line breaks on the client side?
Hello @Hugo C. , thanks for your response
Based on my research, there are off-the-shelf solutions for NDJSON, but I couldn’t find any for concatenated JSON. I’d prefer not to write my own parser for this format because the JSON content is complex and I don’t want to risk misparsing. it feels like a very custom solution. Do you have any recommendations?
you can yield the stringified object + a line break and then use an off the shelf solution for NDJSON
What you said makes a lot of sense! I’ll try it thanks 🙂