Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) AddRoute(topic string, handler paho.MessageHandler)
- func (c *Client) ChannelSubscribe(topic string, qos byte, ch chan paho.Message) error
- func (c *Client) Close() error
- func (c *Client) Connect() (bool, error)
- func (c *Client) CustomSettings() error
- func (c *Client) Subscribe(topic string, qos byte, handler paho.MessageHandler) error
- func (c *Client) SubscribeMultiple(filters map[string]byte, handler paho.MessageHandler) error
- func (c *Client) Write(topic string, value []byte) error
- func (c *Client) WriteJson(topic string, value interface{}) error
- type Config
- type MqttHandlers
Constants ¶
View Source
const ( DefaultTimeout = 5 // seconds DefaultConnectionTimeout = 30 // seconds ErrMissingBroker = utils.Error("at least one broker must be specified") ErrInvalidProtocol = utils.Error("invalid protocol") ErrInvalidTimeout = utils.Error("invalid timeout") ErrInvalidQoSLevel = utils.Error("invalid QoS level") ErrPublishTimeout = utils.Error("timeout when publishing") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { ClientOptions *paho.ClientOptions Client paho.Client QoS byte Timeout time.Duration Retain bool }
func (*Client) ChannelSubscribe ¶
func (*Client) CustomSettings ¶
func (*Client) SubscribeMultiple ¶
type Config ¶
type Config struct { Brokers []string `json:"brokers"` Protocol string `json:"protocol"` Username string `json:"username"` Password string `json:"password"` Timeout int `json:"timeout"` ConnectionTimeout int `json:"connectionTimeout"` QoS int `json:"qos"` ClientID string `json:"clientId"` Retain bool `json:"retain"` KeepAlive int64 `json:"keepAlive"` AutoReconnect bool `json:"autoReconnect"` PersistentSession bool `json:"persistentSession"` tlsProvider.ClientConfig MqttHandlers `json:"-"` }
type MqttHandlers ¶
type MqttHandlers struct { DefaultPublishHandler paho.MessageHandler OnConnect paho.OnConnectHandler OnConnectionLost paho.ConnectionLostHandler OnReconnecting paho.ReconnectHandler OnConnectAttempt paho.ConnectionAttemptHandler CustomOpenConnectionFn paho.OpenConnectionFunc }
Click to show internal directories.
Click to hide internal directories.