Noizu.MCP.Transport.SSE (Noizu MCP v0.1.3)

Copy Markdown View Source

Minimal Server-Sent Events codec used by the Streamable HTTP transport. Encoder for the server side, incremental parser for the client side.

Summary

Functions

Encode one SSE event as iodata.

Incremental parse: feed a chunk plus the leftover buffer, get completed events and the new buffer. Multi-line data: fields are joined per spec.

Functions

encode(data, opts \\ [])

@spec encode(
  String.t() | iodata(),
  keyword()
) :: iodata()

Encode one SSE event as iodata.

parse(buffer, chunk)

@spec parse(binary(), binary()) :: {[Noizu.MCP.Transport.SSE.Event.t()], binary()}

Incremental parse: feed a chunk plus the leftover buffer, get completed events and the new buffer. Multi-line data: fields are joined per spec.