sseevent

package
v0.0.0-...-dea5896 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxScanTokenSize defines max len of sse event
	MaxScanTokenSize = 4096 * 1024
)

Variables

View Source
var (
	ErrClosed = errors.New("already closed")
)

Functions

This section is empty.

Types

type ReadCloser

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

func NewReadCloser

func NewReadCloser(r io.ReadCloser) *ReadCloser

NewReadCloser returns *Reader from wrapped reader r.

It starts routine during first Read(), the parseStarted routine returns when wrapped r is closed, or invalid event is parsed

func (*ReadCloser) Buffer

func (r *ReadCloser) Buffer(buf []byte, max int)

Buffer defines buffer value for internal go routine io.Scanner

func (*ReadCloser) Close

func (r *ReadCloser) Close() error

Close ask wrapped io.readCloser for Close

func (*ReadCloser) Read

func (r *ReadCloser) Read() (*event.Event, error)

Read returns *Event read from EventReader r

func (*ReadCloser) SetContext

func (r *ReadCloser) SetContext(ctx context.Context)

SetContext set reader context, it will replace default reader context, it can't be called after initial Read

type Writer

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

func NewWriter

func NewWriter(w io.Writer) *Writer

func (*Writer) Write

func (w *Writer) Write(ev *event.Event) (int, error)

Jump to

Keyboard shortcuts

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