Documentation ¶
Overview ¶
This package contains the Server Sent Events implementation used by frontier.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Pumped ¶
func Pumped() <-chan struct{}
Pumped returns a channel that will be closed the next time the input pump sends. It can be used similar to `ctx.Done()`, like so: `<-sse.Pumped()`
func Tick ¶
func Tick()
Tick triggers any open SSE streams to tick by replacing and closing the `nextTick` trigger channel.
func WriteEvent ¶
func WriteEvent(ctx context.Context, w http.ResponseWriter, e Event)
WriteEvent does the actual work of formatting an SSE compliant message sending it over the provided ResponseWriter and flushing.
func WritePreamble ¶
func WritePreamble(ctx context.Context, w http.ResponseWriter) bool
WritePreamble prepares this http connection for streaming using Server Sent Events. It sends the initial http response with the appropriate headers to do so.
Types ¶
type Eventable ¶
type Eventable interface { // SseEvent returns the SSE compatible form of the implementer SseEvent() Event }
Eventable represents an object that can be converted to an SSE compatible event.