client

package
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTLSConfig

func CreateTLSConfig(ClientCertificatePath string, PrivateKeyPath string, RootCACertificatePath string) (tlsConfig *tls.Config, err error)

Types

type Client

type Client struct {
	HubId string
	// contains filtered or unexported fields
}

func New

func New(mqttUrl string, userName string, password string, hubId string, authenticationMethod string, mqttVersion MqttVersion, cleanSession bool, autoReconnect bool) (client *Client, err error)

func (*Client) Publish

func (this *Client) Publish(topic string, msg interface{}, qos byte) (err error)

func (*Client) PublishMqtt4

func (this *Client) PublishMqtt4(topic string, payload []byte, qos byte) (err error)

func (*Client) PublishMqtt5

func (this *Client) PublishMqtt5(topic string, payload []byte, qos byte) (err error)

func (*Client) PublishRaw

func (this *Client) PublishRaw(topic string, payload []byte, qos byte) (err error)

func (*Client) Stop

func (this *Client) Stop()

func (*Client) Subscribe

func (this *Client) Subscribe(topic string, qos byte, callback func(topic string, pl []byte)) error

func (*Client) SubscribeMqtt4

func (this *Client) SubscribeMqtt4(topic string, qos byte, callback func(topic string, pl []byte)) error

func (*Client) SubscribeMqtt5

func (this *Client) SubscribeMqtt5(topic string, qos byte, callback func(topic string, pl []byte)) error

func (*Client) Unsubscribe

func (this *Client) Unsubscribe(topic ...string) error

func (*Client) UnsubscribeMqtt4

func (this *Client) UnsubscribeMqtt4(topic ...string) (err error)

func (*Client) UnsubscribeMqtt5

func (this *Client) UnsubscribeMqtt5(topic ...string) (err error)

type MqttVersion

type MqttVersion int
const (
	MQTT4 MqttVersion = iota
	MQTT5
)

type Subscription

type Subscription struct {
	Topic   string
	Handler paho.MessageHandler
	Qos     byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL