network

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusConnected = iota
	StatusDisconnected
	StatusReconnecting
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionStatus

type ConnectionStatus int

type Message

type Message struct {
	// contains filtered or unexported fields
}

func (*Message) Id

func (m *Message) Id() uint16

func (*Message) Payload

func (m *Message) Payload() []byte

func (*Message) Qos

func (m *Message) Qos() Qos

func (*Message) Retained

func (m *Message) Retained() bool

func (*Message) Topic

func (m *Message) Topic() string

type MqttClient

type MqttClient struct {
	// contains filtered or unexported fields
}

func NewMqttClient

func NewMqttClient() *MqttClient

func (*MqttClient) Close

func (c *MqttClient) Close() error

func (*MqttClient) Connect

func (c *MqttClient) Connect(host string, port int, username, password string, onCompletion func(error))

func (*MqttClient) Incoming

func (c *MqttClient) Incoming() <-chan *Message

func (*MqttClient) IsConnected added in v0.0.4

func (c *MqttClient) IsConnected() bool

func (*MqttClient) Publish

func (c *MqttClient) Publish(topic string, qos Qos, retained bool, message []byte, onCompletion func(error))

func (*MqttClient) SetConnectionStatusFunc

func (c *MqttClient) SetConnectionStatusFunc(f func(ConnectionStatus))

func (*MqttClient) Subscribe

func (c *MqttClient) Subscribe(topic string, qos Qos, onCompletion func(error))

func (*MqttClient) Unsubscribe

func (c *MqttClient) Unsubscribe(topic string, onCompletion func(error))

type Qos

type Qos byte
const (
	QosAtMostOnce Qos = iota
	QosAtLeastOnce
	QosExatlyOnce
)

Jump to

Keyboard shortcuts

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