Documentation ¶
Index ¶
- Constants
- Variables
- func NewMsgQueue(limit int) *msgQueue
- type Client
- func (c *Client) AddSubscription(topics []string, qoss []byte) []byte
- func (c *Client) Connected() bool
- func (c *Client) HandleFlow(msg ControlPacket, hrotti *Hrotti)
- func (c *Client) KeepAliveTimer(hrotti *Hrotti)
- func (c *Client) Receive(hrotti *Hrotti)
- func (c *Client) RemoveSubscription(topic string) bool
- func (c *Client) ResetTimer()
- func (c *Client) Send(hrotti *Hrotti)
- func (c *Client) SetRootNode(node *Node)
- func (c *Client) Start(cp *connectPacket, hrotti *Hrotti)
- func (c *Client) Stop(sendWill bool, hrotti *Hrotti)
- func (c *Client) StopForTakeover()
- type Clients
- type ControlPacket
- type Entry
- type FixedHeader
- type Hrotti
- type ListenerConfig
- type MemoryPersistence
- func (p *MemoryPersistence) Add(client *Client, message ControlPacket) bool
- func (p *MemoryPersistence) AddBatch(batch map[*Client]*publishPacket)
- func (p *MemoryPersistence) Close(client *Client)
- func (p *MemoryPersistence) Delete(client *Client, id msgId) bool
- func (p *MemoryPersistence) Exists(client *Client) bool
- func (p *MemoryPersistence) GetAll(client *Client) (messages []ControlPacket)
- func (p *MemoryPersistence) Open(client *Client)
- func (p *MemoryPersistence) Replace(client *Client, message ControlPacket) bool
- type MemoryPersistenceEntry
- type MessageIds
- type Node
- func (n *Node) AddSub(client *Client, subscription []string, qos byte, complete chan byte)
- func (n *Node) DeleteSub(client *Client, subscription []string, complete chan bool)
- func (n *Node) DeleteSubAll(client *Client)
- func (n *Node) DeliverMessage(topic []string, message *publishPacket, hrotti *Hrotti)
- func (n *Node) FindRecipients(topic []string, recipients chan *Entry, wg *sync.WaitGroup)
- func (n *Node) FindRetainedForPlus(client *Client, subscription []string)
- func (n *Node) Print(prefix string) string
- func (n *Node) SendRetainedRecursive(client *Client)
- func (n *Node) SetRetained(topic []string, message *publishPacket)
- type Persistence
- type PersistenceBatchEntry
- type State
- type StateVal
Constants ¶
View Source
const ( CONNECT = byte(1) CONNACK = byte(2) PUBLISH = byte(3) PUBACK = byte(4) PUBREC = byte(5) PUBREL = byte(6) PUBCOMP = byte(7) SUBSCRIBE = byte(8) SUBACK = byte(9) UNSUBSCRIBE = byte(10) UNSUBACK = byte(11) PINGREQ = byte(12) PINGRESP = byte(13) DISCONNECT = byte(14) )
View Source
const ( CONN_ACCEPTED = 0x00 CONN_REF_BAD_PROTO_VER = 0x01 CONN_REF_ID_REJ = 0x02 CONN_REF_SERV_UNAVAIL = 0x03 CONN_REF_BAD_USER_PASS = 0x04 CONN_REF_NOT_AUTH = 0x05 CONN_PROTOCOL_VIOLATION = 0xFF )
Variables ¶
loggers
Functions ¶
func NewMsgQueue ¶
func NewMsgQueue(limit int) *msgQueue
Types ¶
type Client ¶
type Client struct { sync.WaitGroup MessageIds // contains filtered or unexported fields }
func (*Client) AddSubscription ¶
Add a subscription for a client, taking an array of topics to subscribe to and an associated slice of QoS values for the topics, return a slice of byte values indicating the granted QoS values in topics order.
func (*Client) HandleFlow ¶
func (c *Client) HandleFlow(msg ControlPacket, hrotti *Hrotti)
func (*Client) KeepAliveTimer ¶
func (*Client) RemoveSubscription ¶
func (*Client) ResetTimer ¶
func (c *Client) ResetTimer()
func (*Client) SetRootNode ¶
func (*Client) StopForTakeover ¶
func (c *Client) StopForTakeover()
type ControlPacket ¶
type ControlPacket interface { Pack() []byte Unpack([]byte) Type() uint8 SetMsgId(msgId) MsgId() msgId String() string QoS() byte }
func New ¶
func New(packetType byte) ControlPacket
type FixedHeader ¶
type FixedHeader struct { MessageType byte Dup byte Qos byte Retain byte // contains filtered or unexported fields }
func (FixedHeader) String ¶
func (fh FixedHeader) String() string
type Hrotti ¶
type Hrotti struct {
// contains filtered or unexported fields
}
func (*Hrotti) AddListener ¶
func (h *Hrotti) AddListener(name string, config *ListenerConfig) error
func (*Hrotti) InitClient ¶
type ListenerConfig ¶
func NewListenerConfig ¶
func NewListenerConfig(rawURL string) *ListenerConfig
type MemoryPersistence ¶
the MemoryPersistence struct is a map of Client pointers to pointers to a Persistence Entry. So each Client has its own map of msgIds/packets.
func NewMemoryPersistence ¶
func NewMemoryPersistence() *MemoryPersistence
func (*MemoryPersistence) Add ¶
func (p *MemoryPersistence) Add(client *Client, message ControlPacket) bool
func (*MemoryPersistence) AddBatch ¶
func (p *MemoryPersistence) AddBatch(batch map[*Client]*publishPacket)
func (*MemoryPersistence) Close ¶
func (p *MemoryPersistence) Close(client *Client)
func (*MemoryPersistence) Delete ¶
func (p *MemoryPersistence) Delete(client *Client, id msgId) bool
func (*MemoryPersistence) Exists ¶
func (p *MemoryPersistence) Exists(client *Client) bool
func (*MemoryPersistence) GetAll ¶
func (p *MemoryPersistence) GetAll(client *Client) (messages []ControlPacket)
func (*MemoryPersistence) Open ¶
func (p *MemoryPersistence) Open(client *Client)
func (*MemoryPersistence) Replace ¶
func (p *MemoryPersistence) Replace(client *Client, message ControlPacket) bool
type MemoryPersistenceEntry ¶
a persistence entry is a map of msgIds and ControlPackets
type MessageIds ¶
type Node ¶
type Node struct { sync.RWMutex Name string HashSub map[*Client]byte Sub map[*Client]byte Nodes map[string]*Node Retained *publishPacket }
func (*Node) DeleteSubAll ¶
func (*Node) DeliverMessage ¶
func (*Node) FindRecipients ¶
func (*Node) FindRetainedForPlus ¶
func (*Node) SendRetainedRecursive ¶
func (*Node) SetRetained ¶
type Persistence ¶
type Persistence interface { Open(*Client) Close(*Client) Add(*Client, ControlPacket) bool Replace(*Client, ControlPacket) bool AddBatch(map[*Client]*publishPacket) Delete(*Client, msgId) bool GetAll(*Client) []ControlPacket Exists(*Client) bool }
type PersistenceBatchEntry ¶
type PersistenceBatchEntry struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.