Documentation ¶
Index ¶
- type Event
- type Manager
- func (m *Manager) Init()
- func (m *Manager) Register(uid int64) <-chan *Event
- func (m *Manager) Run(ctx context.Context)
- func (m *Manager) SendMessage(uid int64, message *Event)
- func (m *Manager) SendMessageBlocking(uid int64, message *Event)
- func (m *Manager) Unregister(uid int64, channel <-chan *Event)
- func (m *Manager) UnregisterAll()
- type Messenger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { // Name represents the value of the event: tag in the stream Name string // Data is either JSONified []byte or any that can be JSONd Data any // ID represents the ID of an event ID string // Retry tells the receiver only to attempt to reconnect to the source after this time Retry time.Duration }
Event is an eventsource event, not all fields need to be set
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages the eventsource Messengers
func GetManager ¶
func GetManager() *Manager
GetManager returns a Manager and initializes one as singleton if there's none yet
func (*Manager) SendMessage ¶
SendMessage sends a message to a particular user
func (*Manager) SendMessageBlocking ¶
SendMessageBlocking sends a message to a particular user
func (*Manager) Unregister ¶
Unregister message channel
type Messenger ¶
type Messenger struct {
// contains filtered or unexported fields
}
Messenger is a per uid message store
func NewMessenger ¶
NewMessenger creates a messenger for a particular uid
func (*Messenger) SendMessage ¶
SendMessage sends the message to all registered channels
func (*Messenger) SendMessageBlocking ¶
SendMessageBlocking sends the message to all registered channels and ensures it gets sent
func (*Messenger) Unregister ¶
Unregister removes the provider chan []byte
func (*Messenger) UnregisterAll ¶
func (m *Messenger) UnregisterAll()
UnregisterAll removes all chan []byte