mqtt

package module
v0.0.0-...-04cd050 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2016 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidTopic = errors.New("Topic invalid for publishing")
	ErrInvalidSub   = errors.New("Topic invalid for subscribing")
)
View Source
var DefaultBackend = broker.NewMemoryBackend()
View Source
var (
	ErrNoURL = errors.New("No URL specified to listen on")
)

Functions

func New

func New(options ...BusOption) (casa.MessageBus, error)

Initialize a new Bus

Types

type Bus

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

func (*Bus) Close

func (b *Bus) Close() error

func (*Bus) NewClient

func (b *Bus) NewClient() casa.MessageClient

type BusOption

type BusOption func(*Bus) error

func BrokerLogger

func BrokerLogger(logger broker.Logger) BusOption

func ListenOn

func ListenOn(urls ...string) BusOption

func TLS

func TLS(cert tls.Certificate) BusOption

func Users

func Users(users map[string]string) BusOption

type Client

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

func NewClient

func NewClient(url string, options ...ClientOption) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Handle

func (c *Client) Handle(f func(msg *casa.Message, err error))

func (*Client) PublishMessage

func (c *Client) PublishMessage(message casa.Message) error

func (*Client) Subscribe

func (c *Client) Subscribe(topic string) error

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(topic string) error

type ClientOption

type ClientOption func(*Client) error

func CleanSession

func CleanSession(clean bool) ClientOption

func ClientID

func ClientID(id string) ClientOption

func ClientLogger

func ClientLogger(logger client.Logger) ClientOption

func KeepAlive

func KeepAlive(duration time.Duration) ClientOption

func Timeout

func Timeout(timeout time.Duration) ClientOption

func ValidateSubs

func ValidateSubs(validate bool) ClientOption

func Will

func Will(message *casa.Message) ClientOption

Jump to

Keyboard shortcuts

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