Parse events, not bytes
A stream arrives in arbitrary byte chunks, so a line can be split across two. Buffer and split on the event boundary (the blank line), never assume one chunk is one event. That split is where streaming bugs hide.
Handle the end cleanly
The stream ends with a final marker or a close. Flush any partial buffer at the end and treat a broken pipe as a normal stop, not an error. A user stopping a request is not a crash.