Documentation ¶
Overview ¶
Package hub is a event hub system managing events by distributing them to subscribed channels
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct { Subscribers map[chan ServerSideEvent]bool // contains filtered or unexported fields }
Hub is the actual event Hub
func (*Hub) Broadcast ¶
func (h *Hub) Broadcast(event ServerSideEvent)
Broadcast broadcasts the given event to all of the subscribers
func (*Hub) Register ¶
func (h *Hub) Register(channelToRegister chan ServerSideEvent)
Register adds a channel to the event hub
func (*Hub) Unregister ¶
func (h *Hub) Unregister(channelToUnregister chan ServerSideEvent)
Unregister removes a channel from the event hub
type ServerSideEvent ¶
type ServerSideEvent struct { Typus ServerSideEventTypus `json:"typus"` OptionalData interface{} `json:"optional_data,omitempty"` }
ServerSideEvent simulates a event happening on the Server
type ServerSideEventTypus ¶
type ServerSideEventTypus string
ServerSideEventTypus is an alias for string used for ServerSideEvents
const ( HobbitCreated ServerSideEventTypus = "HobbitCreated" HobbitDeleted ServerSideEventTypus = "HobbitDeleted" HobbitModified ServerSideEventTypus = "HobbitModified" RecordCreated ServerSideEventTypus = "RecordCreated" RecordDeleted ServerSideEventTypus = "RecordDeleted" RecordModified ServerSideEventTypus = "RecordModified" )
constants of EventTypus
Click to show internal directories.
Click to hide internal directories.