ssestream

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ssestream incrementally decodes Qoder server-sent events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	Event() Event
	Next() bool
	Close() error
	Err() error
}

func NewDecoder

func NewDecoder(res *http.Response) Decoder

type Event

type Event struct {
	Type  string
	Data  []byte
	ID    string
	Retry int64
}

type Stream

type Stream[T any] struct {
	// contains filtered or unexported fields
}

func NewStream

func NewStream[T any](d Decoder, err error) *Stream[T]

func (*Stream[T]) Close

func (s *Stream[T]) Close() error

func (*Stream[T]) Current

func (s *Stream[T]) Current() T

func (*Stream[T]) Err

func (s *Stream[T]) Err() error

func (*Stream[T]) LastEventID

func (s *Stream[T]) LastEventID() string

LastEventID can be passed as a Last-Event-ID header when the caller reconnects.

func (*Stream[T]) Next

func (s *Stream[T]) Next() bool

Jump to

Keyboard shortcuts

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