sse

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrNilChan will be returned by Notify if it is passed a nil channel
	ErrNilChan = fmt.Errorf("nil channel given")
)

Functions

func Notify

func Notify(uri string, resumeID string, evCh chan<- *Event, stopChan <-chan bool) (string, error)

Notify takes the uri of an SSE stream and channel, and will send an Event down the channel when recieved, until the stream is closed. It will then close the stream. This is blocking, and so you will likely want to call this in a new goroutine (via `go Notify(..)`)

Types

type Event

type Event struct {
	URI  string
	Type string
	ID   string //me
	// contains filtered or unexported fields
}

Event is a go representation of an HTTP server-sent event

func (*Event) GetData

func (e *Event) GetData() io.Reader

GetData returns a read-only view of this Event's data buffer

Jump to

Keyboard shortcuts

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