View Source Anthropic.HTTPTransport.SSE (anthropic_community v0.5.0)

Minimal line-buffering Server-Sent-Events parser. Consumes raw byte chunks (as delivered by Finch.stream/5's :data callback) and emits complete {event_name, data} frames, buffering partial lines and partial frames across chunk boundaries.

Summary

Functions

Feeds a raw byte chunk in; returns the complete frames it produced and the updated parser state.

Types

@type frame() :: {event :: String.t() | nil, data :: String.t()}
@type t() :: %Anthropic.HTTPTransport.SSE{
  buffer: String.t(),
  pending_data: [String.t()],
  pending_event: String.t() | nil
}

Functions

@spec feed(t(), binary()) :: {[frame()], t()}

Feeds a raw byte chunk in; returns the complete frames it produced and the updated parser state.

@spec new() :: t()