# README

mqttx

-- import "."

Usage

func MarshalProto

func MarshalProto(payload proto.Message) ([]byte, error)

func UnmarshalProto

func UnmarshalProto(message []byte) (proto.Message, error)

type Client

type Client interface {
	Connect() error
	Publish(topic string, qos byte, retained bool, payload []byte) error
	Subscribe(topic string, qos byte) (*Subscription, error)
	SubscribeMultiple(filters map[string]byte) (*Subscription, error)
}

func NewClient

func NewClient(options *ClientOptions) Client

type ClientImpl

type ClientImpl struct {
}

func (*ClientImpl) Connect

func (client *ClientImpl) Connect() error

func (*ClientImpl) Publish

func (client *ClientImpl) Publish(topic string, qos byte, retained bool, bytes []byte) error

func (*ClientImpl) Subscribe

func (client *ClientImpl) Subscribe(topic string, qos byte) (*Subscription, error)

func (*ClientImpl) SubscribeMultiple

func (client *ClientImpl) SubscribeMultiple(filters map[string]byte) (*Subscription, error)

type ClientOptions

type ClientOptions struct {
	Servers             []*url.URL
	ClientID            string
	Username            string
	Password            string
	CredentialsProvider mqtt.CredentialsProvider
	CleanSession        bool
	Order               bool
	WillEnabled         bool
	WillTopic           string
	WillPayload         []byte
	WillQos             byte
	WillRetained        bool
	ProtocolVersion     uint

	TLSConfig             *tls.Config
	KeepAlive             int64
	PingTimeout           time.Duration
	ConnectTimeout        time.Duration
	MaxReconnectInterval  time.Duration
	AutoReconnect         bool
	ConnectRetryInterval  time.Duration
	ConnectRetry          bool
	Store                 mqtt.Store
	DefaultPublishHandler mqtt.MessageHandler
	OnConnect             ConnectHandler
	OnConnectionLost      ConnectionLostHandler
	OnReconnecting        ReconnectHandler
	WriteTimeout          time.Duration
	MessageChannelDepth   uint
	ResumeSubs            bool
	HTTPHeaders           http.Header
	WebsocketOptions      *mqtt.WebsocketOptions
}

type ConnectHandler

type ConnectHandler func(client Client)

type ConnectionLostHandler

type ConnectionLostHandler func(client Client, err error)

type Message

type Message interface {
	mqtt.Message
	UnmarshalProto() (proto.Message, error)
}

type ReconnectHandler

type ReconnectHandler func(client Client, opts *ClientOptions)

type Subscription

type Subscription struct {
}

func (*Subscription) Messages

func (sub *Subscription) Messages() chan Message

func (*Subscription) Unsubscribe

func (sub *Subscription) Unsubscribe() error

# Functions

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author