sse

package
v1.0.61 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(reader io.Reader, fn func(event *Event) bool) error

Read reads Server-Sent Events (SSE) from the provided reader and calls the provided function for each event.

Types

type Event

type Event struct {
	ID    g.String // ID uniquely identifies the event.
	Event g.String // Event specifies the type of the event.
	Data  g.String // Data holds the raw JSON data associated with the event as a string.
	Retry g.Int    // Retry indicates the number of retry attempts for the event.
}

Event represents a Server-Sent Event.

func (*Event) Done

func (e *Event) Done() bool

Done checks if the event processing is done.

func (*Event) Skip

func (e *Event) Skip() bool

Skip checks if the event should be skipped.

Jump to

Keyboard shortcuts

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