Documentation ¶
Index ¶
- Constants
- func DelayWritePack(pack *Pack, w *bufio.Writer) (err error)
- func WritePack(pack *Pack, w *bufio.Writer) error
- type Client
- type Connack
- type Connect
- func (c *Connect) GetKeepAlive() int
- func (c *Connect) GetPassword() *string
- func (c *Connect) GetProtocol() *string
- func (c *Connect) GetReturnCode() byte
- func (c *Connect) GetUserName() *string
- func (c *Connect) GetVersion() byte
- func (c *Connect) GetWillMsg() (bool, *string, *string)
- func (c *Connect) IsCleanSession() bool
- type Pack
- func GetConnAckPack(return_code byte) *Pack
- func GetPingResp(qos byte, dup byte) *Pack
- func GetPubAckPack(mid int) *Pack
- func GetPubCOMPPack(mid int) *Pack
- func GetPubPack(qos byte, dup byte, mid int, topic *string, msg []byte) *Pack
- func GetPubRECPack(mid int) *Pack
- func GetPubRELPack(mid int) *Pack
- func GetSubAckPack(mid int) *Pack
- func GetUNSubAckPack(mid int) *Pack
- func ReadPack(r *bufio.Reader, max_pack_length int) (pack *Pack, err error)
- type PackQueue
- type PackRecover
- type Puback
- type Publish
- type Suback
- type Subscribe
- type Topics
- type UNSuback
- type UNSubscribe
- type UNTopics
Constants ¶
View Source
const ( Rserved = iota CONNECT //1 CONNACK //2 PUBLISH //3 PUBACK //4 PUBREC //5 PUBREL //6 PUBCOMP //7 SUBSCRIBE //8 SUBACK //9 UNSUBSCRIBE //10 UNSUBACK //11 PINGREQ //12 PINGRESP //13 DISCONNECT //14 )
View Source
const ( NO_DELAY = iota DELAY FLUSH DISCONNECTED = iota CONNECTED CLOSED RECONNECTING CONNECTING )
1 is delay, 0 is no delay, 2 is just flush.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Listen_loop ¶
Push the msg and response the heart beat
type Connack ¶
type Connack struct {
// contains filtered or unexported fields
}
func (*Connack) GetReturnCode ¶
func (*Connack) SetReturnCode ¶
type Connect ¶
type Connect struct {
// contains filtered or unexported fields
}
func (*Connect) GetKeepAlive ¶
func (*Connect) GetPassword ¶
func (*Connect) GetProtocol ¶
func (*Connect) GetReturnCode ¶
func (*Connect) GetUserName ¶
func (*Connect) GetVersion ¶
func (*Connect) IsCleanSession ¶
type Pack ¶
type Pack struct {
// contains filtered or unexported fields
}
func GetPubPack ¶
Get a publis pack
func GetUNSubAckPack ¶
func (*Pack) GetVariable ¶
func (pack *Pack) GetVariable() interface{}
type PackQueue ¶
type PackQueue struct { MaxPackSize int // mqtt包最大长度 // contains filtered or unexported fields }
Tcp write queue
func NewPackQueue ¶
func NewPackQueue(conf conf.Mqtt, r *bufio.Reader, w *bufio.Writer, conn network.Conn, recover func(pAndErr *packAndErr) (err error), alive, MaxPackSize int) *PackQueue
Init a pack queue
func (*PackQueue) ReadPackInLoop ¶
func (queue *PackQueue) ReadPackInLoop()
Get a read pack queue Only call once
type PackRecover ¶
type PackRecover interface {
OnRecover(*Pack)
}
type UNSubscribe ¶
type UNSubscribe struct {
// contains filtered or unexported fields
}
func (*UNSubscribe) GetMid ¶
func (sub *UNSubscribe) GetMid() int
func (*UNSubscribe) GetTopics ¶
func (sub *UNSubscribe) GetTopics() []Topics
func (*UNSubscribe) SetMid ¶
func (sub *UNSubscribe) SetMid(id int)
Click to show internal directories.
Click to hide internal directories.