Documentation
¶
Index ¶
- type BufferConfig
- type ClientConfig
- type LoggingConfig
- type MQTTClient
- func (m *MQTTClient) Connect() error
- func (m *MQTTClient) Disconnect()
- func (m *MQTTClient) GetClient() mqtt.Client
- func (m *MQTTClient) IsConnected() bool
- func (m *MQTTClient) Publish(topic string, payload interface{}) error
- func (m *MQTTClient) PublishWithQoS(topic string, payload interface{}, qos byte) error
- func (m *MQTTClient) Subscribe(topic string, callback mqtt.MessageHandler) error
- func (m *MQTTClient) SubscribeWithQoS(topic string, qos byte, callback mqtt.MessageHandler) error
- func (m *MQTTClient) Unsubscribe(topics ...string) error
- type MQTTServiceProvider
- type MessageConfig
- type Options
- type PerformanceConfig
- type PublishConfig
- type SubscriptionConfig
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferConfig ¶
type BufferConfig struct {
SendBufferSize int `json:"send-buffer-size"`
ReceiveBufferSize int `json:"receive-buffer-size"`
MessageQueueSize int `json:"message-queue-size"`
}
BufferConfig 缓冲区配置
type ClientConfig ¶
type ClientConfig struct {
ID string `json:"id"`
Username string `json:"username"`
Password string `json:"password"`
CleanSession bool `json:"clean-session"`
KeepAlive int `json:"keep-alive"`
ConnectTimeout int `json:"connect-timeout"`
AutoReconnect bool `json:"auto-reconnect"`
ReconnectInterval int `json:"reconnect-interval"`
MaxReconnectAttempts int `json:"max-reconnect-attempts"`
}
ClientConfig 客户端配置
type LoggingConfig ¶
type LoggingConfig struct {
Debug bool `json:"debug"`
LogConnectionEvents bool `json:"log-connection-events"`
LogMessageEvents bool `json:"log-message-events"`
}
LoggingConfig 日志配置
type MQTTClient ¶
type MQTTClient struct {
// contains filtered or unexported fields
}
MQTTClient MQTT 客户端包装器
func (*MQTTClient) Publish ¶
func (m *MQTTClient) Publish(topic string, payload interface{}) error
Publish 发布消息
func (*MQTTClient) PublishWithQoS ¶
func (m *MQTTClient) PublishWithQoS(topic string, payload interface{}, qos byte) error
PublishWithQoS 使用指定 QoS 发布消息
func (*MQTTClient) Subscribe ¶
func (m *MQTTClient) Subscribe(topic string, callback mqtt.MessageHandler) error
Subscribe 订阅主题
func (*MQTTClient) SubscribeWithQoS ¶
func (m *MQTTClient) SubscribeWithQoS(topic string, qos byte, callback mqtt.MessageHandler) error
SubscribeWithQoS 使用指定 QoS 订阅主题
func (*MQTTClient) Unsubscribe ¶
func (m *MQTTClient) Unsubscribe(topics ...string) error
Unsubscribe 取消订阅
type MQTTServiceProvider ¶
type MQTTServiceProvider struct {
// contains filtered or unexported fields
}
func (*MQTTServiceProvider) Boot ¶
func (m *MQTTServiceProvider) Boot()
func (*MQTTServiceProvider) Conf ¶ added in v1.3.0
func (m *MQTTServiceProvider) Conf() map[string]string
func (*MQTTServiceProvider) Description ¶ added in v1.3.0
func (m *MQTTServiceProvider) Description() string
func (*MQTTServiceProvider) Register ¶
func (m *MQTTServiceProvider) Register()
type MessageConfig ¶
type MessageConfig struct {
DefaultQoS byte `json:"default-qos"`
Retain bool `json:"retain"`
Timeout int `json:"timeout"`
}
MessageConfig 消息配置
type Options ¶
type Options struct {
Broker string `json:"broker"`
Client ClientConfig `json:"client"`
TLS TLSConfig `json:"tls"`
Message MessageConfig `json:"message"`
Subscription SubscriptionConfig `json:"subscription"`
Publish PublishConfig `json:"publish"`
Logging LoggingConfig `json:"logging"`
Buffer BufferConfig `json:"buffer"`
Performance PerformanceConfig `json:"performance"`
}
Options MQTT 配置选项
type PerformanceConfig ¶
type PerformanceConfig struct {
MaxConcurrentConnections int `json:"max-concurrent-connections"`
MessageHandlerCount int `json:"message-handler-count"`
BatchSize int `json:"batch-size"`
}
PerformanceConfig 性能配置
type PublishConfig ¶
type PublishConfig struct {
DefaultQoS byte `json:"default-qos"`
Timeout int `json:"timeout"`
WaitForAck bool `json:"wait-for-ack"`
}
PublishConfig 发布配置
type SubscriptionConfig ¶
type SubscriptionConfig struct {
DefaultQoS byte `json:"default-qos"`
Timeout int `json:"timeout"`
}
SubscriptionConfig 订阅配置
Click to show internal directories.
Click to hide internal directories.