sse

package module
v0.0.0-...-622e8bd Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventToBytes

func EventToBytes(event Event) []byte

Types

type BasicEvent

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

func (BasicEvent) Data

func (e BasicEvent) Data() string

func (BasicEvent) Event

func (e BasicEvent) Event() string

func (BasicEvent) ID

func (e BasicEvent) ID() string

type Event

type Event interface {
	ID() string
	Event() string
	Data() string
}

type EventBroker

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

func NewBroker

func NewBroker() *EventBroker

func StartNewBroker

func StartNewBroker() *EventBroker

func (*EventBroker) SendEvent

func (b *EventBroker) SendEvent(event Event)

func (*EventBroker) Start

func (b *EventBroker) Start()

func (*EventBroker) Stop

func (b *EventBroker) Stop()

func (*EventBroker) Subscribe

func (b *EventBroker) Subscribe(stream *EventStream)

func (*EventBroker) Unsubscribe

func (b *EventBroker) Unsubscribe(stream *EventStream)

type EventStream

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

func NewEventStream

func NewEventStream(w http.ResponseWriter) (*EventStream, error)

func StartNewEventStream

func StartNewEventStream(w http.ResponseWriter) (*EventStream, error)

func (*EventStream) CloseNotify

func (es *EventStream) CloseNotify() <-chan bool

func (*EventStream) SendEvent

func (es *EventStream) SendEvent(event Event)

func (*EventStream) Start

func (es *EventStream) Start()

func (*EventStream) Stop

func (es *EventStream) Stop()

type EventWriter

type EventWriter interface {
	http.ResponseWriter
	http.Flusher
	http.CloseNotifier
}

type TestStream

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

func NewTestStream

func NewTestStream(start bool) (*TestStream, error)

func (*TestStream) CloseRecorder

func (t *TestStream) CloseRecorder()

func (*TestStream) EventStream

func (t *TestStream) EventStream() *EventStream

func (*TestStream) Received

func (t *TestStream) Received(event Event) bool

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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