sse

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package sse implements a streaming Server-Sent Events reader shared by the Rico and Paywall AI agent clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Name    string // value of the "event:" field, if any
	Data    string // "data:" lines joined with "\n"
	Comment bool   // frame contained only ":" comment lines
}

Event is one SSE frame. Comment-only frames (keepalives) are surfaced with Comment set so callers can reset inactivity timers.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader incrementally decodes SSE frames from a stream.

func NewReader

func NewReader(r io.Reader) *Reader

func (*Reader) Next

func (r *Reader) Next() (Event, error)

Next returns the next frame, or io.EOF when the stream ends. Frames with no data and no comment (stray blank lines) are skipped.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL