Documentation ¶
Index ¶
- Variables
- func ArrayContainsString(array []string, value string) bool
- func Broadcast(room string, endpoint string, message *Message)
- func DeregisterMicroservice(name string)
- func GetConfig(name string) interface{}
- func Listen(endpoint string, callback func(client *Client, request *Request) *Message)
- func LoadConfig(name string, path string)
- func MapToStruct(input map[string]interface{}, output interface{}) error
- func OnAfterBroadcast(callback func(endpoint string, room string, response *Message))
- func OnAfterClientBroadcast(callback func(client *Client, endpoint string, room string, response *Message))
- func OnAfterRequest(callback func(client *Client, request *Request, response *Message))
- func OnAfterResponse(callback func(client *Client, request *Request, response *Message))
- func OnBeforeBroadcast(callback func(endpoint string, room string, response *Message))
- func OnBeforeClientBroadcast(callback func(client *Client, endpoint string, room string, response *Message))
- func OnBeforeRequest(callback func(client *Client, request *Request))
- func OnBeforeResponse(callback func(client *Client, request *Request, response *Message))
- func OnConnect(callback func(client *Client, request *Request))
- func OnDisconnect(callback func(client *Client, request *Request))
- func RegisterMicroservice(name string, host string, port int, secure bool) error
- func RegisterPlugin(plugin Plugin)
- func Shutdown()
- func Startup(config map[string]interface{})
- func StructToMap(input interface{}) map[string]interface{}
- type AppSettings
- type Client
- type GoMessage
- type Message
- type Microservice
- func (m *Microservice) Call(endpoint string, message *Message) (*Message, error)
- func (m *Microservice) Connect() (*Microservice, error)
- func (m *Microservice) Connected() bool
- func (m *Microservice) Disconnect()
- func (m *Microservice) Go(endpoint string, message *Message) chan *GoMessage
- func (m *Microservice) Listen(endpoint string, callback func(message *Message))
- func (m *Microservice) Lob(endpoint string, message *Message) error
- type Plugin
- type Request
- type Session
Constants ¶
This section is empty.
Variables ¶
var SupportedPlatforms []string
SupportedPlatforms is an array of OS platform names that this framework works well on
Functions ¶
func ArrayContainsString ¶
ArrayContainsString checks to see if a value exists in the array
func DeregisterMicroservice ¶
func DeregisterMicroservice(name string)
DeregisterMicroservice disconnects and removes a microservice from App.Microservices
func GetConfig ¶
func GetConfig(name string) interface{}
GetConfig returns a configuration from App.Config
func LoadConfig ¶
LoadConfig loads a JSON configuration file into the global Config map
func MapToStruct ¶
MapToStruct converts the given map[string]interface{} into a struct
func OnAfterBroadcast ¶
OnAfterBroadcast registers an event handler that fires after a global broadcast is sent to all clients
func OnAfterClientBroadcast ¶
func OnAfterClientBroadcast(callback func(client *Client, endpoint string, room string, response *Message))
OnAfterClientBroadcast registers an event handler that fires after a client broadcast is sent to other clients
func OnAfterRequest ¶
OnAfterRequest registers an event handler that fires after a request is processed by the controller
func OnAfterResponse ¶
OnAfterResponse registers an event handler that fires after a response is processed by the controller
func OnBeforeBroadcast ¶
OnBeforeBroadcast registers an event handler that fires before a global broadcast is sent to all clients
func OnBeforeClientBroadcast ¶
func OnBeforeClientBroadcast(callback func(client *Client, endpoint string, room string, response *Message))
OnBeforeClientBroadcast registers an event handler that fires before a client broadcast is sent to other clients
func OnBeforeRequest ¶
OnBeforeRequest registers an event handler that fires before a request is processed by the controller
func OnBeforeResponse ¶
OnBeforeResponse registers an event handler that fires before a response is processed by the controller
func OnDisconnect ¶
OnDisconnect registers an event handler that fires when a client disconnects
func RegisterMicroservice ¶
RegisterMicroservice configures, automatically connects, and adds the microservice to App.Microservices
func RegisterPlugin ¶
func RegisterPlugin(plugin Plugin)
RegisterPlugin is used by the plugin to register itself for later activation
func Startup ¶
func Startup(config map[string]interface{})
Startup activates the framework and starts the server
func StructToMap ¶
func StructToMap(input interface{}) map[string]interface{}
StructToMap converts the given structure into a map[string]interface{}
Types ¶
type AppSettings ¶
type AppSettings struct { Env map[string]string Config map[string]interface{} Microservices map[string]*Microservice }
AppSettings holds global settings for the application
var App AppSettings
App is a global registry for application variables
type Client ¶
type Client struct { Rooms []string // contains filtered or unexported fields }
Client represents a single connected client
func (*Client) Broadcast ¶
Broadcast sends a message to connected clients joined to the same room with the exception of the "client"
func (*Client) Disconnect ¶
func (c *Client) Disconnect()
Disconnect forces a client to be disconnected from the server
type Message ¶
type Message struct { ID int `json:"id,omitempty"` GUID string `json:"guid,omitempty"` UUID string `json:"uuid,omitempty"` Success bool `json:"success"` Text string `json:"text,omitempty"` Meta map[string]interface{} `json:"meta,omitempty"` Body map[string]interface{} `json:"body,omitempty"` A string `json:"a,omitempty"` P map[string]interface{} `json:"p,omitempty"` K string `json:"k,omitempty"` }
Message - Standard message type for Socket communications
func NewFailureMessage ¶
func NewFailureMessage(args ...interface{}) *Message
NewFailureMessage generates a failure message
func NewSuccessMessage ¶
func NewSuccessMessage(args ...interface{}) *Message
NewSuccessMessage generates a success message
func ReadGoMessage ¶
ReadGoMessage reads from a microservice Go channel of type *GoMessage
func (*Message) WithoutMeta ¶
WithoutMeta removes meta information before returning a copy of the message
type Microservice ¶
type Microservice struct {
// contains filtered or unexported fields
}
Microservice defines a microservice connection
func GetMicroservice ¶
func GetMicroservice(name string) *Microservice
GetMicroservice retrieves a microservice reference from App.Microservices
func (*Microservice) Call ¶
func (m *Microservice) Call(endpoint string, message *Message) (*Message, error)
Call sends a request to the microservice
func (*Microservice) Connect ¶
func (m *Microservice) Connect() (*Microservice, error)
Connect manually connects or reconnects to the microservice
func (*Microservice) Connected ¶
func (m *Microservice) Connected() bool
Connected tells whether or not this microservice's connection is still active and alive
func (*Microservice) Disconnect ¶
func (m *Microservice) Disconnect()
Disconnect manually terminates the connection to the microservice
func (*Microservice) Go ¶
func (m *Microservice) Go(endpoint string, message *Message) chan *GoMessage
Go sends a request to the microservice returning channels
func (*Microservice) Listen ¶
func (m *Microservice) Listen(endpoint string, callback func(message *Message))
Listen registers and event handler for a microservice endpoint
type Plugin ¶
type Plugin interface { Activate(app *AppSettings) Deactivate(app *AppSettings) }
Plugin is the framework interface defining a plugin