Documentation
¶
Index ¶
- Constants
- Variables
- func NewConnAckError(returnCode byte, text string) error
- type ConnackPacket
- type ConnectAckError
- type ConnectPacket
- type ControlPacket
- type DisconnectPacket
- type FixedHeader
- type PingreqPacket
- type PingrespPacket
- type PubackPacket
- type PubcompPacket
- type PublishPacket
- type PubrecPacket
- type PubrelPacket
- type SubackPacket
- type SubscribePacket
- type TopicSubscription
- type UnsubackPacket
- type UnsubscribePacket
Constants ¶
View Source
const ( MQTT = "MQTT" MQTT_3_1_1 byte = 4 MQTT_5 byte = 5 )
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 AUTH byte = 15 // mqtt-v5.0 )
View Source
const ( AT_MOST_ONCE = 0 AT_LEAST_ONCE = 1 EXACTLY_ONCE = 2 FAILURE = 0x80 )
Variables ¶
View Source
var MqttMessageTypeNames = map[byte]string{ CONNECT: "CONNECT", CONNACK: "CONNACK", PUBLISH: "PUBLISH", PUBACK: "PUBACK", PUBREC: "PUBREC", PUBREL: "PUBREL", PUBCOMP: "PUBCOMP", SUBSCRIBE: "SUBSCRIBE", SUBACK: "SUBACK", UNSUBSCRIBE: "UNSUBSCRIBE", UNSUBACK: "UNSUBACK", PINGREQ: "PINGREQ", PINGRESP: "PINGRESP", DISCONNECT: "DISCONNECT", AUTH: "AUTH", }
View Source
var MqttQoSNames = map[byte]string{ AT_MOST_ONCE: "AT_MOST_ONCE", AT_LEAST_ONCE: "AT_LEAST_ONCE", EXACTLY_ONCE: "EXACTLY_ONCE", FAILURE: "FAILURE", }
Functions ¶
func NewConnAckError ¶
Types ¶
type ConnackPacket ¶
type ConnackPacket struct { FixedHeader SessionPresent bool ReturnCode byte }
func (*ConnackPacket) Name ¶
func (p *ConnackPacket) Name() string
func (*ConnackPacket) String ¶
func (p *ConnackPacket) String() string
func (*ConnackPacket) Type ¶
func (p *ConnackPacket) Type() byte
type ConnectAckError ¶
type ConnectAckError struct {
// contains filtered or unexported fields
}
func (*ConnectAckError) Error ¶
func (e *ConnectAckError) Error() string
func (*ConnectAckError) ReturnCode ¶
func (e *ConnectAckError) ReturnCode() byte
type ConnectPacket ¶
type ConnectPacket struct { FixedHeader ProtocolName string ProtocolLevel byte HasUsername bool HasPassword bool WillRetain bool WillQos byte WillFlag bool CleanSession bool ReservedBit bool KeepAliveSeconds uint16 ClientIdentifier string WillTopic string WillMessage []byte Username string Password []byte }
func (*ConnectPacket) Name ¶
func (p *ConnectPacket) Name() string
func (*ConnectPacket) String ¶
func (p *ConnectPacket) String() string
func (*ConnectPacket) Type ¶
func (p *ConnectPacket) Type() byte
type ControlPacket ¶
type ControlPacket interface { Write(io.Writer) error Unpack(io.Reader) error String() string Type() byte Name() string }
func NewControlPacket ¶
func NewControlPacket(packetType byte) ControlPacket
func NewControlPacketWithHeader ¶
func NewControlPacketWithHeader(fh FixedHeader) (ControlPacket, error)
func ReadPacket ¶
func ReadPacket(r io.Reader) (ControlPacket, error)
type DisconnectPacket ¶
type DisconnectPacket struct {
FixedHeader
}
func (*DisconnectPacket) Name ¶
func (p *DisconnectPacket) Name() string
func (*DisconnectPacket) String ¶
func (p *DisconnectPacket) String() string
func (*DisconnectPacket) Type ¶
func (p *DisconnectPacket) Type() byte
type FixedHeader ¶
func (*FixedHeader) MessageName ¶
func (fh *FixedHeader) MessageName() string
func (FixedHeader) String ¶
func (fh FixedHeader) String() string
type PingreqPacket ¶
type PingreqPacket struct {
FixedHeader
}
func (*PingreqPacket) Name ¶
func (p *PingreqPacket) Name() string
func (*PingreqPacket) String ¶
func (p *PingreqPacket) String() string
func (*PingreqPacket) Type ¶
func (p *PingreqPacket) Type() byte
type PingrespPacket ¶
type PingrespPacket struct {
FixedHeader
}
func (*PingrespPacket) Name ¶
func (p *PingrespPacket) Name() string
func (*PingrespPacket) String ¶
func (p *PingrespPacket) String() string
func (*PingrespPacket) Type ¶
func (p *PingrespPacket) Type() byte
type PubackPacket ¶
type PubackPacket struct { FixedHeader MessageID uint16 }
func (*PubackPacket) Name ¶
func (p *PubackPacket) Name() string
func (*PubackPacket) String ¶
func (p *PubackPacket) String() string
func (*PubackPacket) Type ¶
func (p *PubackPacket) Type() byte
type PubcompPacket ¶
type PubcompPacket struct { FixedHeader MessageID uint16 }
func (*PubcompPacket) Name ¶
func (p *PubcompPacket) Name() string
func (*PubcompPacket) String ¶
func (p *PubcompPacket) String() string
func (*PubcompPacket) Type ¶
func (p *PubcompPacket) Type() byte
type PublishPacket ¶
type PublishPacket struct { FixedHeader TopicName string MessageID uint16 Message []byte }
func (*PublishPacket) Name ¶
func (c *PublishPacket) Name() string
func (*PublishPacket) String ¶
func (p *PublishPacket) String() string
func (*PublishPacket) Type ¶
func (p *PublishPacket) Type() byte
type PubrecPacket ¶
type PubrecPacket struct { FixedHeader MessageID uint16 }
func (*PubrecPacket) Name ¶
func (p *PubrecPacket) Name() string
func (*PubrecPacket) String ¶
func (p *PubrecPacket) String() string
func (*PubrecPacket) Type ¶
func (p *PubrecPacket) Type() byte
type PubrelPacket ¶
type PubrelPacket struct { FixedHeader MessageID uint16 }
func (*PubrelPacket) Name ¶
func (p *PubrelPacket) Name() string
func (*PubrelPacket) String ¶
func (p *PubrelPacket) String() string
func (*PubrelPacket) Type ¶
func (p *PubrelPacket) Type() byte
type SubackPacket ¶
type SubackPacket struct { FixedHeader MessageID uint16 ReturnCodes []byte }
func (*SubackPacket) Name ¶
func (p *SubackPacket) Name() string
func (*SubackPacket) String ¶
func (p *SubackPacket) String() string
func (*SubackPacket) Type ¶
func (p *SubackPacket) Type() byte
type SubscribePacket ¶
type SubscribePacket struct { FixedHeader MessageID uint16 TopicSubscriptions []TopicSubscription }
func (*SubscribePacket) Name ¶
func (p *SubscribePacket) Name() string
func (*SubscribePacket) String ¶
func (p *SubscribePacket) String() string
func (*SubscribePacket) Type ¶
func (p *SubscribePacket) Type() byte
type TopicSubscription ¶
func (*TopicSubscription) String ¶
func (ts *TopicSubscription) String() string
type UnsubackPacket ¶
type UnsubackPacket struct { FixedHeader MessageID uint16 }
func (*UnsubackPacket) Name ¶
func (p *UnsubackPacket) Name() string
func (*UnsubackPacket) String ¶
func (p *UnsubackPacket) String() string
func (*UnsubackPacket) Type ¶
func (p *UnsubackPacket) Type() byte
type UnsubscribePacket ¶
type UnsubscribePacket struct { FixedHeader MessageID uint16 TopicFilters []string }
func (*UnsubscribePacket) Name ¶
func (p *UnsubscribePacket) Name() string
func (*UnsubscribePacket) String ¶
func (p *UnsubscribePacket) String() string
func (*UnsubscribePacket) Type ¶
func (p *UnsubscribePacket) Type() byte
Click to show internal directories.
Click to hide internal directories.