client

package
v0.0.0-...-e5a160e Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: MIT Imports: 8 Imported by: 2

Documentation

Overview

Copyright 2014, Shuhei Tanuma. All rights reserved. Use of this source code is governed by a MIT license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Connection      *MyConnection
	PublishCallback func(string, []byte)
	Option          Option
	CleanSession    bool
	Subscribed      map[string]int
	Mutex           sync.RWMutex
	Errors          chan error
	Kicker          *time.Timer
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opt Option) *Client

func (*Client) Connect

func (self *Client) Connect() error

func (*Client) Disconnect

func (self *Client) Disconnect()

func (*Client) Loop

func (self *Client) Loop()

func (*Client) On

func (self *Client) On(event string, callback interface{}, args ...bool) error

func (*Client) Publish

func (self *Client) Publish(TopicName string, Payload []byte, QoSLevel int)

func (*Client) PublishWait

func (self *Client) PublishWait(TopicName string, Payload []byte, QoSLevel int) error

func (*Client) PublishWithRetain

func (self *Client) PublishWithRetain(TopicName string, Payload []byte, QoSLevel int)

func (*Client) SetRequestPerSecondLimit

func (self *Client) SetRequestPerSecondLimit(limit int)

func (*Client) Subscribe

func (self *Client) Subscribe(topic string, QoS int) error

func (*Client) Terminate

func (self *Client) Terminate()

terminate means loop terminate

func (*Client) Unsubscribe

func (self *Client) Unsubscribe(topic string)

func (*Client) WaitConnection

func (self *Client) WaitConnection()

type Option

type Option struct {
	TransporterCallback func() (net.Conn, error)
	Magic               []byte
	Version             int
	Identifier          string
	Ticker              *time.Ticker
	TickerCallback      func(time.Time, *Client) error
	WillTopic           string
	WillMessage         []byte
	WillRetain          bool
	WillQos             int
	CleanSession        bool
	UserName            string
	Password            string
	Keepalive           int // THIS IS REALLY TROBULESOME
	Logger              log.Logger
}

Jump to

Keyboard shortcuts

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