Documentation ¶
Index ¶
- type Actor
- type ActorGroup
- type Client
- type EventBroadcaster
- type EventListener
- func (e *EventListener) ActiveChan() chan bool
- func (e *EventListener) AddHandler(types []string, function func(interface{})) *EventTarget
- func (e *EventListener) Disconnect()
- func (e *EventListener) Err() error
- func (e *EventListener) IsActive() bool
- func (e *EventListener) RemoveHandler(target *EventTarget) error
- func (e *EventListener) Wait() error
- type EventTarget
- type Events
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶
type Actor interface { // ID returns the unique ID for the actor ID() string // Types returns the underlying types the actor subscribes to Types() []string // Write pushes information to the actor Write([]byte) error // Close the actor Close() // NoForward decides if messages should be forwarded to the actor NoForward() bool // Done returns if the actor is done messaging. Done() bool }
Actor defines an broker between event messages and nodes
type ActorGroup ¶
type ActorGroup interface { // Add an actor to a group Add(a Actor) // Prune removes any done actors Prune() bool // Walk over the actors with in the group one by one (order is not // guaranteed). Walk(func(Actor) error) error }
ActorGroup holds a group of actors
type Client ¶
type Client interface { // Websocket allows directly connection to API websockets Websocket(path string) (*websocket.Conn, error) }
Client represents a way to interact with the server API
type EventBroadcaster ¶
type EventBroadcaster struct {
// contains filtered or unexported fields
}
EventBroadcaster allows messages to be dispatched to other actors.
func NewEventBroadcaster ¶
func NewEventBroadcaster(actorGroup ActorGroup, logger log.Logger) *EventBroadcaster
NewEventBroadcaster creates a new EventBroadcaster
func (*EventBroadcaster) Dispatch ¶
func (e *EventBroadcaster) Dispatch(event map[string]interface{}) error
Dispatch an event to other awaiting actors.
type EventListener ¶
type EventListener struct {
// contains filtered or unexported fields
}
EventListener struct is used to interact with a event stream
func (*EventListener) ActiveChan ¶
func (e *EventListener) ActiveChan() chan bool
ActiveChan returns the underlying channel
func (*EventListener) AddHandler ¶
func (e *EventListener) AddHandler(types []string, function func(interface{})) *EventTarget
AddHandler adds a function to be called whenever an event is received
func (*EventListener) Disconnect ¶
func (e *EventListener) Disconnect()
Disconnect must be used once done listening for events
func (*EventListener) Err ¶
func (e *EventListener) Err() error
Err return the potentially underlying error
func (*EventListener) IsActive ¶
func (e *EventListener) IsActive() bool
IsActive returns true if this listener is still connected, false otherwise.
func (*EventListener) RemoveHandler ¶
func (e *EventListener) RemoveHandler(target *EventTarget) error
RemoveHandler removes a function to be called whenever an event is received
func (*EventListener) Wait ¶
func (e *EventListener) Wait() error
Wait hangs until the server disconnects the connection or Disconnect() is called
type EventTarget ¶
type EventTarget struct {
// contains filtered or unexported fields
}
EventTarget struct is returned to the caller of AddHandler and used in RemoveHandler
type Events ¶
type Events struct {
// contains filtered or unexported fields
}
Events represents the API for the Events
func (*Events) GetEvents ¶
func (e *Events) GetEvents() (*EventListener, error)
GetEvents connects to monitoring interface
type Option ¶
type Option func(*options)
Option to be passed to Connect to customize the resulting instance.
func WithLogger ¶
WithLogger sets the logger on the option