sse

package module
v0.0.0-...-865cf51 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoStreamMake

func AutoStreamMake(auto bool) eventStreamOptionFunc

func DefaultEventStream

func DefaultEventStream(id string) serverOptionFunc

func DiscoverEventStream

func DiscoverEventStream(discoverEventStream DiscoverEventStreamFunc) serverOptionFunc

func RegisterEventStream

func RegisterEventStream(id string, eventSourceFactory event.SourceFactoryFunc, options ...eventStreamOptionFunc) serverOptionFunc

func RegisterStream

func RegisterStream(id string) eventStreamOptionFunc

Types

type DiscoverEventStreamFunc

type DiscoverEventStreamFunc func(request *http.Request) string

type EventStream

type EventStream interface {
	GetStream(id string) (Stream, bool)
	GetSource() event.Source
}

type Server

type Server interface {
	http.Handler
}

func New

func New(ctx context.Context, options ...serverOptionFunc) (Server, error)

type Stream

type Stream interface {
	Subscribe(subscriber Subscriber) func()
	Broadcast(event event.Event)
}

type Subscriber

type Subscriber interface {
	Events() chan event.Event
	Subscribed()
	SubscribedCount() int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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