Documentation ¶
Index ¶
Constants ¶
const ( CONNECT = uint8(iota + 1) CONNACK PUBLISH PUBACK PUBREC PUBREL PUBCOMP SUBSCRIBE SUBACK UNSUBSCRIBE UNSUBACK PINGREQ PINGRESP DISCONNECT )
Variables ¶
This section is empty.
Functions ¶
func SetMaxPacketSize ¶
func SetMaxPacketSize(lim int64)
SetMaxPacketSize allows us to limit the size of an incoming packet below the mqtt minimum 256MB
Types ¶
type Connack ¶
type Connack struct {
ReturnCode uint8
}
Connack struct, the return codes are as follows 0x00 connection accepted 0x01 refused: unacceptable proto version 0x02 refused: identifier rejected 0x03 refused server unavailiable 0x04 bad user or password 0x05 not authorized
type Connect ¶
type Connect struct { ProtoName string Version uint8 UsernameFlag bool PasswordFlag bool WillRetainFlag bool WillQOS uint8 WillFlag bool CleanSeshFlag bool KeepAlive uint16 ClientId string WillTopic TopicPath WillMessage string Username string Password string }
/Connect is a struct for the packet of the same name
type Disconnect ¶
type Disconnect struct { }
Disconnect is to signal you want to cease communications with the server
func (*Disconnect) Encode ¶
func (d *Disconnect) Encode() []byte
Encode for disconnect reutrns the encoded disconnect value
type Pingreq ¶
type Pingreq struct { }
Pingreq is a keepalive
type Pingresp ¶
type Pingresp struct { }
Pingresp is for saying "hey, the server is alive"
type Puback ¶
type Puback struct {
MessageId uint16
}
Puback is sent for QOS level one to verify the reciept of a publish Qoth the spec: "A PUBACK message is sent by a server in response to a PUBLISH message from a publishing client, and by a subscriber in response to a PUBLISH message from the server."
type Pubcomp ¶
type Pubcomp struct {
MessageId uint16
}
Pubcomp is for saying is in response to a pubrel sent by the publisher the final member of the QOS2 flow. both sides have said "hey, we did it!"
type Publish ¶
type Publish struct { Header *StaticHeader Topic TopicPath MessageId uint16 Payload []byte }
Pubit
type Pubrec ¶
type Pubrec struct {
MessageId uint16
}
Pubrec is for verifying the reciept of a publish Qoth the spec:"It is the second message of the QoS level 2 protocol flow. A PUBREC message is sent by the server in response to a PUBLISH message from a publishing client, or by a subscriber in response to a PUBLISH message from the server."
type Pubrel ¶
type Pubrel struct { MessageId uint16 //QOS1 Header *StaticHeader }
Pubrelis third, a response to pubrec from either the client or server.
type StaticHeader ¶
StaticHeader as defined in http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html#fixed-header Though it's fixed header there
type Suback ¶
Suback is to say "hey, you got it buddy. I will send you messages that fit this pattern"
type Subscribe ¶
type Subscribe struct { Header *StaticHeader MessageId uint16 Subscriptions []TopicQOSTuple }
Subscribe tells the server which topics the client would like to subscribe to
type TopicPath ¶
func CutOffSystemKey ¶
func NewTopicPath ¶
NewTopicPath creates a TopicPath object from the this function could be more efficient
type TopicQOSTuple ¶
TopicQOSTuple is a struct for pairing the Qos and topic together for the QOS' pairs in unsubscribe and subscribe
type Unsuback ¶
type Unsuback struct {
MessageId uint16
}
Unsuback is to unsubscribe as suback is to subscribe
type Unsubscribe ¶
type Unsubscribe struct { Header *StaticHeader MessageId uint16 Topics []TopicQOSTuple }
Unsubscribe is the message to send if you don't want to subscribe to a topic anymore
func (*Unsubscribe) Encode ¶
func (u *Unsubscribe) Encode() []byte
Encode encodes the unsubscribe. All it is is the bodies of the subscribes