kinetex - v1.0.0-rc.1
    Preparing search index...

    Class SSEParser

    Line-level state machine that parses raw SSE text into structured SSEEvent objects.

    Implements the WHATWG EventSource parsing algorithm, including multi-line data, id persistence across events, and retry field extraction.

    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    • get lastId(): string | null

      The last event ID parsed from id: fields, persisted across events per SSE spec.

      Returns string | null

    Methods

    • Feed raw text into the parser.

      Per the SSE specification, the id field persists across events - it is NOT reset when an event is dispatched. Only the reset() method (called on reconnect) clears the id. This allows clients to use Last-Event-ID for resumption after temporary disconnections.

      Parameters

      • chunk: string

        Raw SSE text chunk.

      Returns SSEEvent[]

      Any complete events found in this chunk.

    • Flush any remaining buffer content. Call when the stream ends.

      Returns SSEEvent | null

      A final event if data was buffered, or null.

    • Reset parser state completely (e.g. on reconnect).

      Returns void