sse

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0 Imports: 4 Imported by: 2 modules, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stream

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

Stream writes SSE frames and bounds each client write.

func New

func New(w http.ResponseWriter) *Stream

New constructs a Stream for w.

func (*Stream) BeginWrite

func (s *Stream) BeginWrite() error

BeginWrite starts a bounded write sequence. Call Flush after its frames.

func (*Stream) ClearWriteDeadline

func (s *Stream) ClearWriteDeadline() error

ClearWriteDeadline ends a write sequence that failed before Flush.

func (*Stream) Data

func (s *Stream) Data(data []byte) error

Data writes and flushes an SSE data frame.

func (*Stream) Flush

func (s *Stream) Flush() error

Flush delivers pending frames and clears their write deadline.

func (*Stream) KeepAlive

func (s *Stream) KeepAlive() error

KeepAlive writes and flushes an SSE comment heartbeat.

func (*Stream) Writef

func (s *Stream) Writef(format string, args ...any) error

Writef writes an SSE frame. Call Flush to deliver buffered frames.

Jump to

Keyboard shortcuts

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