Documentation ¶
Index ¶
- Constants
- type Client
- func (client *Client) EventBus() eventbus.Bus
- func (client *Client) Start() error
- func (client *Client) Stop()
- func (client *Client) Subscribe(topic string, fn interface{}, serverAddr, serverPath string)
- func (client *Client) SubscribeOnce(topic string, fn interface{}, serverAddr, serverPath string)
- type ClientArg
- type ClientService
- type NetworkBus
- type NetworkBusService
- type Server
- type ServerService
- type SubscribeArg
- type SubscribeType
Constants ¶
const (
// PublishService - Client service method
PublishService = "ClientService.PushEvent"
)
const (
// RegisterService - Server subscribe service method
RegisterService = "ServerService.Register"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client - object capable of subscribing to a remote event bus
func (*Client) EventBus ¶
func (client *Client) EventBus() eventbus.Bus
EventBus - returns the underlying event bus
func (*Client) SubscribeOnce ¶
SubscribeOnce subscribes once to a topic in a remote event bus
type ClientArg ¶
type ClientArg struct { Args []interface{} Topic string }
ClientArg - object containing event for client to publish locally
type ClientService ¶
type ClientService struct {
// contains filtered or unexported fields
}
ClientService - service object listening to events published in a remote event bus
type NetworkBus ¶
NetworkBus - object capable of subscribing to remote event buses in addition to remote event busses subscribing to it's local event bus. Compoed of a server and client
func NewNetworkBus ¶
func NewNetworkBus(address, path string) *NetworkBus
NewNetworkBus - returns a new network bus object at the server address and path
func (*NetworkBus) EventBus ¶
func (networkBus *NetworkBus) EventBus() eventbus.Bus
EventBus - returns wrapped event bus
func (*NetworkBus) Start ¶
func (networkBus *NetworkBus) Start() error
Start - helper method to serve a network bus service
func (*NetworkBus) Stop ¶
func (networkBus *NetworkBus) Stop()
Stop - signal for the service to stop serving
type NetworkBusService ¶
type NetworkBusService struct {
// contains filtered or unexported fields
}
NetworkBusService - object capable of serving the network bus
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server - object capable of being subscribed to by remote handlers
func (*Server) EventBus ¶
func (server *Server) EventBus() eventbus.Bus
EventBus - returns wrapped event bus
func (*Server) HasClientSubscribed ¶
func (server *Server) HasClientSubscribed(arg *SubscribeArg) bool
HasClientSubscribed - True if a client subscribed to this server with the same topic
type ServerService ¶
type ServerService struct {
// contains filtered or unexported fields
}
ServerService - service object to listen to remote subscriptions
func (*ServerService) Register ¶
func (service *ServerService) Register(arg *SubscribeArg, success *bool) error
Register - Registers a remote handler to this event bus for a remote subscribe - a given client address only needs to subscribe once event will be republished in local event bus
type SubscribeArg ¶
type SubscribeArg struct { ClientAddr string ClientPath string ServiceMethod string SubscribeType SubscribeType Topic string }
SubscribeArg - object to hold subscribe arguments from remote event handlers
type SubscribeType ¶
type SubscribeType int
SubscribeType - how the client intends to subscribe
const ( // Subscribe - subscribe to all events Subscribe SubscribeType = iota // SubscribeOnce - subscribe to only one event SubscribeOnce )