Documentation
¶
Overview ¶
Package mqtt provides paho mqtt implementation to connect with AWS IoT Gateway
Index ¶
- type AWSIoTConnection
- func (c *AWSIoTConnection) Disconnect() bool
- func (c *AWSIoTConnection) Publish(topic string, data interface{}, qos byte) error
- func (c *AWSIoTConnection) Subscribe(topic string, qos byte) error
- func (c *AWSIoTConnection) SubscribeWithHandler(topic string, qos byte, handler MQTT.MessageHandler) error
- func (c *AWSIoTConnection) Unsubscribe(topic string) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSIoTConnection ¶
type AWSIoTConnection struct {
// contains filtered or unexported fields
}
AWSIoTConnection holds connection for AWS IoT
func NewConnection ¶
func NewConnection(config Config) (*AWSIoTConnection, error)
NewConnection Creates new MQTT connection with AWS IoT It requires config parameter for initialisation
func (*AWSIoTConnection) Disconnect ¶
func (c *AWSIoTConnection) Disconnect() bool
Disconnect function disconnects the MQTT connection only if its already connected else returns error
func (*AWSIoTConnection) Publish ¶
func (c *AWSIoTConnection) Publish(topic string, data interface{}, qos byte) error
Publish function publishes data in interface on topic with level of qos (Quality of service) currently supported 0 & 1 (2 coming in future)
func (*AWSIoTConnection) Subscribe ¶
func (c *AWSIoTConnection) Subscribe(topic string, qos byte) error
Subscribe function subscribes on topic with level of qos (Quality of service) currently supported 0 & 1 (2 coming in future).
func (*AWSIoTConnection) SubscribeWithHandler ¶
func (c *AWSIoTConnection) SubscribeWithHandler(topic string, qos byte, handler MQTT.MessageHandler) error
SubscribeWithHandler function subscribes on topic with level of qos (Quality of service) currently supported 0 & 1 (2 coming in future) & handler function to listen to incoming messages for the topic & qos level. It is called every time when message is received
func (*AWSIoTConnection) Unsubscribe ¶
func (c *AWSIoTConnection) Unsubscribe(topic string) error
Unsubscribe function removes subscription for specified topic
type Config ¶
type Config struct { KeyPath string `json:"keyPath" binding:"required"` CertPath string `json:"certPath" binding:"required"` CAPath string `json:"caPath" binding:"required"` ClientId string `json:"clientId" binding:"required"` Endpoint string `json:"endpoint" binding:"required"` }
Config struct holds connection parameters for AWSIoTConnection initialisation All parameters are compulsory KeyPath is path to x.509 Private Key CertPath is path to x.509 Public Key CAPath is path to CA certificate ClientId is the clientId of thing Endpoint is Unique AWS IoT endpoint provided by AWS IoT
Directories
¶
Path | Synopsis |
---|---|
topics
|
|
lifecycle
Package lifecycle provides topics to intercept thing lifecycle & subscription events
|
Package lifecycle provides topics to intercept thing lifecycle & subscription events |
registry
Package registry provides topics for Device registry operations
|
Package registry provides topics for Device registry operations |