smidge

package
v0.0.0-...-b83f79d Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2015 License: EPL-1.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNCONNECTED byte = iota
	CONNECTING
	CONNECTED
)
View Source
const (
	NET = "[net]     "
	PNG = "[pinger]  "
	CLI = "[client]  "
	DEC = "[decode]  "
	MES = "[message] "
	STR = "[store]   "
	MID = "[msgids]  "
	TST = "[test]    "
	STA = "[state]   "
	ERR = "[error]   "
)

Variables

View Source
var (
	ERROR    *log.Logger
	CRITICAL *log.Logger
	WARN     *log.Logger
	DEBUG    *log.Logger
)

Functions

This section is empty.

Types

type Client

type Client interface {
	Connect()
}

type ConnectToken

type ConnectToken struct {
	ReturnCode byte
	// contains filtered or unexported fields
}

func (*ConnectToken) Wait

func (b *ConnectToken) Wait()

Wait will wait indefinitely for the Token to complete, ie the Publish to be sent and confirmed receipt from the broker

func (*ConnectToken) WaitTimeout

func (b *ConnectToken) WaitTimeout(d time.Duration)

WaitTimeout takes a time in ms

type MessageAndToken

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

type MessageHandler

type MessageHandler func(client *SNClient, message *P.PublishMessage)

type PublishToken

type PublishToken struct {
	TopicId    uint16
	ReturnCode byte
	// contains filtered or unexported fields
}

func (*PublishToken) Wait

func (b *PublishToken) Wait()

Wait will wait indefinitely for the Token to complete, ie the Publish to be sent and confirmed receipt from the broker

func (*PublishToken) WaitTimeout

func (b *PublishToken) WaitTimeout(d time.Duration)

WaitTimeout takes a time in ms

type RegisterToken

type RegisterToken struct {
	TopicName  string
	TopicId    uint16
	ReturnCode byte
	// contains filtered or unexported fields
}

func (*RegisterToken) Wait

func (b *RegisterToken) Wait()

Wait will wait indefinitely for the Token to complete, ie the Publish to be sent and confirmed receipt from the broker

func (*RegisterToken) WaitTimeout

func (b *RegisterToken) WaitTimeout(d time.Duration)

WaitTimeout takes a time in ms

type SNClient

type SNClient struct {
	sync.RWMutex
	ClientId                  string
	OutstandingMessages       map[uint16]P.Message
	RegisteredTopics          map[string]uint16
	MessageHandlers           map[uint16]MessageHandler
	PredefinedTopics          map[string]uint16
	PredefinedMessageHandlers map[uint16]MessageHandler
	DefaultMessageHandler     MessageHandler
	MessageIds                mids
	// contains filtered or unexported fields
}

func NewClient

func NewClient(server string, clientid string) (*SNClient, error)

func (*SNClient) Connect

func (c *SNClient) Connect() *ConnectToken

func (*SNClient) Predefine

func (c *SNClient) Predefine(topic string, topicid uint16) error

func (*SNClient) Publish

func (c *SNClient) Publish(topic string, qos byte, retain bool, data []byte) *PublishToken

func (*SNClient) PublishPredefined

func (c *SNClient) PublishPredefined(topicid uint16, qos byte, retain bool, data []byte) *PublishToken

func (*SNClient) Register

func (c *SNClient) Register(topic string) *RegisterToken

func (*SNClient) SetWill

func (c *SNClient) SetWill(topic string, qos byte, retain bool, data []byte)

func (*SNClient) SetWillData

func (c *SNClient) SetWillData(d []byte) *WillToken

func (*SNClient) SetWillQos

func (c *SNClient) SetWillQos(q byte) *WillToken

func (*SNClient) SetWillRetain

func (c *SNClient) SetWillRetain(r bool) *WillToken

func (*SNClient) SetWillTopic

func (c *SNClient) SetWillTopic(t string) *WillToken

func (*SNClient) Subscribe

func (c *SNClient) Subscribe(topic string, qos byte, mh MessageHandler) *SubscribeToken

func (*SNClient) SubscribePredefined

func (c *SNClient) SubscribePredefined(topicid uint16, qos byte, mh MessageHandler) *SubscribeToken

type SubscribeToken

type SubscribeToken struct {
	Qos        byte
	TopicName  string
	TopicId    uint16
	ReturnCode byte
	// contains filtered or unexported fields
}

func (*SubscribeToken) Wait

func (b *SubscribeToken) Wait()

Wait will wait indefinitely for the Token to complete, ie the Publish to be sent and confirmed receipt from the broker

func (*SubscribeToken) WaitTimeout

func (b *SubscribeToken) WaitTimeout(d time.Duration)

WaitTimeout takes a time in ms

type Token

type Token interface {
	Wait()
	WaitTimeout(time.Duration)
	// contains filtered or unexported methods
}

type UnsubscribeToken

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

func (*UnsubscribeToken) Wait

func (b *UnsubscribeToken) Wait()

Wait will wait indefinitely for the Token to complete, ie the Publish to be sent and confirmed receipt from the broker

func (*UnsubscribeToken) WaitTimeout

func (b *UnsubscribeToken) WaitTimeout(d time.Duration)

WaitTimeout takes a time in ms

type Will

type Will struct {
	Topic  string
	Data   []byte
	Qos    byte
	Retain bool
}

type WillToken

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

func (*WillToken) Wait

func (b *WillToken) Wait()

Wait will wait indefinitely for the Token to complete, ie the Publish to be sent and confirmed receipt from the broker

func (*WillToken) WaitTimeout

func (b *WillToken) WaitTimeout(d time.Duration)

WaitTimeout takes a time in ms

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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