sse

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package sse provides a reusable Server-Sent Events reader.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// Event is the SSE event type (from "event:" line). Empty for data-only events.
	Event string
	// Data is the event payload (from "data:" line(s)). Multi-line data is joined with newlines.
	Data string
	// ID is the event ID (from "id:" line).
	ID string
}

Event represents a single server-sent event.

type Reader

type Reader interface {
	// Next returns the next SSE event. Returns io.EOF when the stream ends.
	Next() (*Event, error)
	// Close releases the underlying resources.
	Close() error
}

Reader reads server-sent events from a stream.

func NewReader

func NewReader(body io.ReadCloser) Reader

NewReader creates an SSE reader from a readable stream.

Jump to

Keyboard shortcuts

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