notifications

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT, Apache-2.0, MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SubscribeWithData added in v1.7.1

func SubscribeWithData(p Subscribable, topic Topic, notifee Notifee)

SubscribeWithData subscribes to the given subscriber on the given topic, and adds the notifies custom data into the list of data injected into callbacks when events occur on that topic

Types

type Event

type Event interface{}

Event is a publishable event

type EventTransform

type EventTransform func(Event) Event

EventTransform if a fucntion transforms one kind of event to another

type Notifee

type Notifee struct {
	Data       TopicData
	Subscriber *TopicDataSubscriber
}

Notifee is a topic data subscriber plus a set of data you want to add to any topics subscribed to (used to call SubscribeWithData to inject data when events for a given topic emit)

type Publisher

type Publisher interface {
	Close(Topic)
	Publish(Topic, Event)
	Shutdown()
	Startup()
	Subscribable
}

Publisher is an publisher of events that can be subscribed to

func NewPublisher

func NewPublisher() Publisher

NewPublisher returns a new message event publisher

type Subscribable

type Subscribable interface {
	Subscribe(topic Topic, sub Subscriber) bool
	Unsubscribe(sub Subscriber) bool
}

Subscribable is a stream that can be subscribed to

type Subscriber

type Subscriber interface {
	OnNext(Topic, Event)
	OnClose(Topic)
}

Subscriber is a subscriber that can receive events

type Topic

type Topic interface{}

Topic is a topic that events appear on

type TopicData added in v1.7.1

type TopicData interface{}

TopicData is data added to every message broadcast on a topic

type TopicDataSubscriber added in v1.7.1

type TopicDataSubscriber struct {
	Subscriber
	// contains filtered or unexported fields
}

func NewTopicDataSubscriber added in v1.7.1

func NewTopicDataSubscriber(sub Subscriber) *TopicDataSubscriber

NewTopicDataSubscriber produces a subscriber that will transform events and topics before passing them on to the given subscriber

func (*TopicDataSubscriber) AddTopicData added in v1.7.1

func (m *TopicDataSubscriber) AddTopicData(id Topic, data TopicData)

func (*TopicDataSubscriber) OnClose added in v1.7.1

func (m *TopicDataSubscriber) OnClose(topic Topic)

func (*TopicDataSubscriber) OnNext added in v1.7.1

func (m *TopicDataSubscriber) OnNext(topic Topic, ev Event)

Jump to

Keyboard shortcuts

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