Documentation ¶
Index ¶
Constants ¶
View Source
const ( ConnectType = 1 ConnackType = 2 PublishType = 3 PubackType = 4 PubrecType = 5 PubrelType = 6 PubcompType = 7 SubscribeType = 8 SubackType = 9 UnsubscribeType = 10 UnsubackType = 11 PingreqType = 12 PingrespType = 13 DisconnectType = 14 )
Below are the constants assigned to each of the MQTT packet types
View Source
const ( Accepted = 0x00 ErrRefusedBadProtocolVersion = 0x01 ErrRefusedIDRejected = 0x02 ErrRefusedBadUsernameOrPassword = 0x04 ErrRefusedNotAuthorised = 0x05 ErrNetworkError = 0xFE ErrProtocolViolation = 0xFF )
Below are the const definitions for error codes returned by Connect()
Variables ¶
View Source
var ConnErrors = map[byte]error{ Accepted: nil, ErrRefusedBadProtocolVersion: errors.New("Unnacceptable protocol version"), ErrRefusedIDRejected: errors.New("Identifier rejected"), ErrRefusedServerUnavailable: errors.New("Server Unavailable"), ErrRefusedBadUsernameOrPassword: errors.New("Bad user name or password"), ErrRefusedNotAuthorised: errors.New("Not Authorized"), ErrNetworkError: errors.New("Network Error"), ErrProtocolViolation: errors.New("Protocol Violation"), }
ConnErrors is a map of the errors codes constants for Connect() to a Go error
View Source
var ConnackReturnCodes = map[uint8]string{
0: "Connection Accepted",
1: "Connection Refused: Bad Protocol Version",
2: "Connection Refused: Client Identifier Rejected",
3: "Connection Refused: Server Unavailable",
4: "Connection Refused: Username or Password in unknown format",
5: "Connection Refused: Not Authorised",
254: "Connection Error",
255: "Connection Refused: Protocol Violation",
}
ConnackReturnCodes is a map of the error codes constants for Connect() to a string representation of the error
Functions ¶
This section is empty.
Types ¶
type Connect ¶
type Connect struct { Header Header ProtocolName string ProtocolVersion byte CleanSession bool WillFlag bool WillQos byte WillRetain bool UsernameFlag bool PasswordFlag bool ReservedBit byte Keepalive uint16 ClientIdentifier string WillTopic string WillMessage []byte Username string Password []byte }
type Disconnect ¶
type Disconnect struct {
Header Header
}
func (*Disconnect) Marshal ¶
func (p *Disconnect) Marshal() ([]byte, error)
func (*Disconnect) MarshalTo ¶
func (p *Disconnect) MarshalTo(buffer []byte) error
func (*Disconnect) Size ¶
func (p *Disconnect) Size() int
func (*Disconnect) Unmarshal ¶
func (p *Disconnect) Unmarshal(_ []byte) error
type Packet ¶
type UnSubscribe ¶
func (*UnSubscribe) Marshal ¶
func (s *UnSubscribe) Marshal() ([]byte, error)
func (*UnSubscribe) MarshalTo ¶
func (s *UnSubscribe) MarshalTo(buffer []byte) error
func (*UnSubscribe) Size ¶
func (s *UnSubscribe) Size() int
func (*UnSubscribe) Unmarshal ¶
func (s *UnSubscribe) Unmarshal(data []byte) error
Click to show internal directories.
Click to hide internal directories.