Documentation ¶
Index ¶
- Constants
- Variables
- func New(carrierType int) func(carrierCompany int, config *Config) interface{}
- func NewMQTT(carrierCompany int, config *Config) interface{}
- func NewMail(carrierCompany int, config *Config) interface{}
- func NewWebsocket(carrierCompany int, config *Config) interface{}
- type Config
- type CustomMailClient
- type CustomMailConfigModel
- type EclipseClient
- type EclipseConfigModel
- type GorillaClient
- type GorillaConfigModel
- type IMQTT
- type IMail
- type IWebsocket
Constants ¶
const ( // WEBSOCKET services WEBSOCKET = iota // MQTT services MQTT // MAIL services MAIL )
const ( // CUSTOMMAIL services CUSTOMMAIL = iota )
const ( // ECLIPSE services ECLIPSE = iota )
const ( // GORILLA services GORILLA = iota )
Variables ¶
var ( // EclipseClientSessionMapping singleton pattern EclipseClientSessionMapping = make(map[string]*EclipseClient) )
Functions ¶
func NewWebsocket ¶
NewWebsocket Factory Pattern
Types ¶
type Config ¶
type Config struct { Gorilla GorillaConfigModel `json:"gorilla,omitempty"` Eclipse EclipseConfigModel `json:"eclipse,omitempty"` CustomMail CustomMailConfigModel `json:"customMail,omitempty"` }
Config model for carrier services
type CustomMailClient ¶
type CustomMailClient struct {
// contains filtered or unexported fields
}
CustomMailClient manage all Gomail client actions
type CustomMailConfigModel ¶
type CustomMailConfigModel struct { PoolSize int `json:"poolSize"` Host string `json:"host"` Port string `json:"port"` Identity string `json:"identity"` Username string `json:"username"` Password string `json:"password"` }
CustomMailConfigModel connection config model
type EclipseClient ¶
type EclipseClient struct {
// contains filtered or unexported fields
}
EclipseClient manage all MQTT client actions
func (*EclipseClient) IsConnected ¶
func (ec *EclipseClient) IsConnected() bool
IsConnected return connection state
func (*EclipseClient) Publish ¶
func (ec *EclipseClient) Publish(topic, message string) error
Publish message to channel
func (*EclipseClient) Subscribe ¶
func (ec *EclipseClient) Subscribe(topic string, messageHandler mqtt.MessageHandler) error
Subscribe message from channel
type EclipseConfigModel ¶
type EclipseConfigModel struct { ClientID string `json:"clientID"` URL string `json:"url"` Username string `json:"username"` Password string `json:"password"` }
EclipseConfigModel connection config model
type GorillaClient ¶
type GorillaClient struct {
// contains filtered or unexported fields
}
GorillaClient manage all websocket client actions
func (*GorillaClient) Read ¶
func (gc *GorillaClient) Read() (interface{}, error)
Read message from channel
func (*GorillaClient) Write ¶
func (gc *GorillaClient) Write(message string) error
Write message to channel
type GorillaConfigModel ¶
type GorillaConfigModel struct { Scheme string `json:"scheme"` URL string `json:"url"` Channel string `json:"channel"` RecIntervalMin time.Duration `json:"recIntervalMin"` // RecIntervalMin specifies the initial reconnecting interval, example: 2 * time.Second (2 seconds) RecIntervalMax time.Duration `json:"recIntervalMax"` // RecIntervalMax specifies the maximum reconnecting interval, example: 30 * time.Second (30 seconds) RecIntervalFactor float64 `json:"recIntervalFactor"` // RecIntervalFactor specifies the rate of increase of the reconnection interval, example: 0.5 * time.Second (0.5 seconds) }
GorillaConfigModel connection config model
type IMQTT ¶
type IMQTT interface { Publish(topic, message string) error Subscribe(topic string, messageHandler mqtt.MessageHandler) error IsConnected() bool End() }
IMQTT factory pattern interface
func NewEclipseClient ¶
func NewEclipseClient(config *EclipseConfigModel) IMQTT
NewEclipseClient init new instance
type IMail ¶
IMail factory pattern interface
func NewCustomMailClient ¶
func NewCustomMailClient(config *CustomMailConfigModel) IMail
NewCustomMailClient init new instance
type IWebsocket ¶
IWebsocket factory pattern interface
func NewGorillaClient ¶
func NewGorillaClient(config *GorillaConfigModel) IWebsocket
NewGorillaClient init new instance