Documentation ¶
Index ¶
- func ReadVarint(reader io.Reader) (int, error)
- func WriteMessageTo(message Message, w io.Writer) (int64, error)
- func WriteVarint(writer io.Writer, size int) (int, error)
- type ConnackMessage
- type ConnectMessage
- type DisconnectMessage
- type FixedHeader
- type Message
- type PacketType
- type ParseError
- type PingreqMessage
- type PingrespMessage
- type PubackMessage
- type PubcompMessage
- type PublishMessage
- type PubrecMessage
- type PubrelMessage
- type ReturnCode
- type SubackMessage
- type SubscribeMessage
- type SubscribePayload
- type UnsubackMessage
- type UnsubscribeMessage
- type WillMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnackMessage ¶
type ConnackMessage struct { FixedHeader Reserved uint8 ReturnCode uint8 }
func NewConnackMessage ¶
func NewConnackMessage() *ConnackMessage
func (*ConnackMessage) String ¶
func (self *ConnackMessage) String() string
type ConnectMessage ¶
type ConnectMessage struct { FixedHeader Magic []byte `json:"magic"` Version uint8 `json:"version"` Flag uint8 `json:"flag"` KeepAlive uint16 `json:"keep_alive"` Identifier string `json:"identifier"` Will *WillMessage `json:"will"` CleanSession bool `json:clean_session` UserName []byte `json:"user_name"` Password []byte `json:"password"` }
func NewConnectMessage ¶
func NewConnectMessage() *ConnectMessage
func (*ConnectMessage) String ¶
func (self *ConnectMessage) String() string
type DisconnectMessage ¶
type DisconnectMessage struct {
FixedHeader
}
func NewDisconnectMessage ¶
func NewDisconnectMessage() *DisconnectMessage
func (*DisconnectMessage) String ¶
func (self *DisconnectMessage) String() string
type FixedHeader ¶
type FixedHeader struct { Type PacketType Dupe bool QosLevel int Retain int RemainingLength int }
func (*FixedHeader) GetType ¶
func (self *FixedHeader) GetType() PacketType
func (*FixedHeader) GetTypeAsString ¶
func (self *FixedHeader) GetTypeAsString() string
func (*FixedHeader) String ¶
func (self *FixedHeader) String() string
type Message ¶
type Message interface { GetType() PacketType GetTypeAsString() string }
func CopyMessage ¶
type PacketType ¶
type PacketType int
const ( PACKET_TYPE_RESERVED1 PacketType = 0 PACKET_TYPE_CONNECT PacketType = 1 PACKET_TYPE_CONNACK PacketType = 2 PACKET_TYPE_PUBLISH PacketType = 3 PACKET_TYPE_PUBACK PacketType = 4 PACKET_TYPE_PUBREC PacketType = 5 PACKET_TYPE_PUBREL PacketType = 6 PACKET_TYPE_PUBCOMP PacketType = 7 PACKET_TYPE_SUBSCRIBE PacketType = 8 PACKET_TYPE_SUBACK PacketType = 9 PACKET_TYPE_UNSUBSCRIBE PacketType = 10 PACKET_TYPE_UNSUBACK PacketType = 11 PACKET_TYPE_PINGREQ PacketType = 12 PACKET_TYPE_PINGRESP PacketType = 13 PACKET_TYPE_DISCONNECT PacketType = 14 PACKET_TYPE_RESERVED2 PacketType = 15 )
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
func (ParseError) Error ¶
func (self ParseError) Error() string
type PingreqMessage ¶
type PingreqMessage struct {
FixedHeader
}
func NewPingreqMessage ¶
func NewPingreqMessage() *PingreqMessage
func (*PingreqMessage) String ¶
func (self *PingreqMessage) String() string
type PingrespMessage ¶
type PingrespMessage struct {
FixedHeader
}
func NewPingrespMessage ¶
func NewPingrespMessage() *PingrespMessage
func (*PingrespMessage) String ¶
func (self *PingrespMessage) String() string
type PubackMessage ¶
type PubackMessage struct { FixedHeader PacketIdentifier uint16 }
func NewPubackMessage ¶
func NewPubackMessage() *PubackMessage
func (*PubackMessage) String ¶
func (self *PubackMessage) String() string
type PubcompMessage ¶
type PubcompMessage struct { FixedHeader PacketIdentifier uint16 }
func NewPubcompMessage ¶
func NewPubcompMessage() *PubcompMessage
func (*PubcompMessage) String ¶
func (self *PubcompMessage) String() string
type PublishMessage ¶
type PublishMessage struct { FixedHeader `json:"header"` TopicName string `json:"topic_name"` PacketIdentifier uint16 `json:"identifier"` Payload []byte `json:"payload"` Opaque interface{} `json:"-"` }
func CopyPublishMessage ¶
func CopyPublishMessage(msg *PublishMessage) (*PublishMessage, error)
func MustCopyPublishMessage ¶
func MustCopyPublishMessage(msg *PublishMessage) *PublishMessage
func NewPublishMessage ¶
func NewPublishMessage() *PublishMessage
func (*PublishMessage) String ¶
func (self *PublishMessage) String() string
type PubrecMessage ¶
type PubrecMessage struct { FixedHeader PacketIdentifier uint16 }
func NewPubrecMessage ¶
func NewPubrecMessage() *PubrecMessage
func (*PubrecMessage) String ¶
func (self *PubrecMessage) String() string
type PubrelMessage ¶
type PubrelMessage struct { FixedHeader PacketIdentifier uint16 }
func NewPubrelMessage ¶
func NewPubrelMessage() *PubrelMessage
func (*PubrelMessage) String ¶
func (self *PubrelMessage) String() string
type ReturnCode ¶
type ReturnCode int
const ( CONNECTION_ACCEOTED ReturnCode = 1 CONNECTION_REFUSED_UNACCEPTABLE_PROTOCOL_VERSION ReturnCode = 2 CONNECTION_REFUSED_IDENTIFIER_REJECTED ReturnCode = 3 CONNECTION_REFUSED_SERVER_UNAVAILABLE ReturnCode = 4 CONNECTION_REFUSED_BAD_USER_NAME_OR_PASSWORD ReturnCode = 5 CONNECTION_REFUSED_NOT_AUTHORIZED ReturnCode = 6 )
type SubackMessage ¶
type SubackMessage struct { FixedHeader PacketIdentifier uint16 Qos []byte }
func NewSubackMessage ¶
func NewSubackMessage() *SubackMessage
func (*SubackMessage) String ¶
func (self *SubackMessage) String() string
type SubscribeMessage ¶
type SubscribeMessage struct { FixedHeader PacketIdentifier uint16 Payload []SubscribePayload }
func NewSubscribeMessage ¶
func NewSubscribeMessage() *SubscribeMessage
func (*SubscribeMessage) String ¶
func (self *SubscribeMessage) String() string
type SubscribePayload ¶
type UnsubackMessage ¶
type UnsubackMessage struct { FixedHeader PacketIdentifier uint16 }
func NewUnsubackMessage ¶
func NewUnsubackMessage() *UnsubackMessage
func (*UnsubackMessage) String ¶
func (self *UnsubackMessage) String() string
type UnsubscribeMessage ¶
type UnsubscribeMessage struct { FixedHeader TopicName string PacketIdentifier uint16 Payload []SubscribePayload }
func NewUnsubscribeMessage ¶
func NewUnsubscribeMessage() *UnsubscribeMessage
func (*UnsubscribeMessage) String ¶
func (self *UnsubscribeMessage) String() string
type WillMessage ¶
type WillMessage struct { Qos uint8 `json:"qos"` Topic string `json:"topic"` Message string `json:"message"` Retain bool `json:retain` }
func (*WillMessage) Size ¶
func (self *WillMessage) Size() int
func (*WillMessage) String ¶
func (self *WillMessage) String() string
Click to show internal directories.
Click to hide internal directories.