Documentation ¶
Index ¶
- Variables
- func Open(ctx context.Context, url string) <-chan Event
- func OpenWithClient(ctx context.Context, client *http.Client, url string) <-chan Event
- func ReadEvents(in io.Reader, events chan<- Event) error
- func RunOnce(ctx context.Context, client *http.Client, url string, events chan<- Event) error
- type Event
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultSSEClient = &http.Client{Timeout: 0}
DefaultSSEClient is the default client to use when connecting to a SSE endpoint. It's configured with no timeout so that it can stay connected indefinitely receiving events.
View Source
var ReconnectDelay = 1 * time.Second
The amount of time the client should wait between reconnecting to the SSE endpoint.
Functions ¶
func OpenWithClient ¶
func ReadEvents ¶
ReadEvents parses and interprets an event stream according to the W3C working draft for Server-Sent Events found at: https://www.w3.org/TR/2009/WD-eventsource-20090421. If a non-EOF error occurs while reading data then it is returned.
Types ¶
Click to show internal directories.
Click to hide internal directories.