# `ReqManagedAgents.SSE`
[🔗](https://github.com/cash-mckeeman/req_managed_agents/blob/v0.12.0/req_managed_agents/lib/req_managed_agents/sse.ex#L1)

Pure Server-Sent-Events frame decoder for the Managed Agents event stream.

`decode/1` takes an accumulated buffer and returns `{events, remainder}` where
`events` are the decoded JSON maps for every *complete* frame in the buffer and
`remainder` is the trailing partial frame to prepend to the next chunk. No
network, no state — call it repeatedly as bytes arrive.

# `decode`

```elixir
@spec decode(binary()) :: {[map()], binary()}
```

Decode complete SSE frames from `buffer`.

Frames are separated by a blank line (`\n\n` or `\r\n\r\n`). Within a
frame, `data:` lines are concatenated with newlines and JSON-decoded. Comment
lines (starting `:`) and non-`data:` lines are ignored. Undecodable JSON is
dropped.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
