Documentation
¶
Overview ¶
Package sse reads server-sent event streams (text/event-stream), as defined by the HTML Living Standard. It is built for load generation: a Reader reuses its buffers, so reading an event does not allocate once the buffers have grown to the stream's largest event.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrTooLarge = errors.New("sse: event larger than the limit")
ErrTooLarge is returned when one event or line exceeds the reader's limit.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
// Type is the event field, or "message" when the stream sets none.
Type string
ID string
Data []byte
}
Event is one dispatched event. Data is only valid until the next call to Next; copy it to keep it.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader parses events from a stream.
func NewReader ¶
NewReader reads events from r. An event or line larger than limit bytes stops the stream with ErrTooLarge; limit <= 0 means 10 MiB.
Click to show internal directories.
Click to hide internal directories.