Documentation ¶
Index ¶
Constants ¶
const ( Accepted = 0x00 ErrRefusedBadProtocolVersion = 0x01 ErrRefusedIDRejected = 0x02 ErrRefusedbADID = 0x03 ErrNotAuthorised = 0x05 ErrBadRequest = 0x06 )
Below are the const definitions for error codes returned by Connect()
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connect ¶
type Connect struct { Version int32 InsecureFlag bool ClientID string KeepAlive int32 CleanSessFlag bool SessKey int32 Username string Password []byte BatchDuration int32 BatchByteThreshold int32 BatchCountThreshold int32 }
Connect represents a connect Message.
func (*Connect) FromBinary ¶
func (c *Connect) FromBinary(fh FixedHeader, data []byte)
type ConnectAcknowledge ¶
ConnectAcknowledge represents a CONNECT Acknowledge Message. 0x00 connection accepted 0x01 refused: unacceptable proto version 0x02 refused: identifier rejected 0x03 refused: unacceptable identifier, access not allowed 0x04 refused server unavailiable 0x05 not authorized 0x06 bad request
func (*ConnectAcknowledge) FromBinary ¶
func (c *ConnectAcknowledge) FromBinary(fh FixedHeader, data []byte)
func (*ConnectAcknowledge) Info ¶
func (c *ConnectAcknowledge) Info() Info
Info returns DeliveryMode and MessageID of this Message.
func (*ConnectAcknowledge) Type ¶
func (c *ConnectAcknowledge) Type() MessageType
Type returns the Message type.
type ControlMessage ¶
type ControlMessage struct { MessageID uint16 MessageType MessageType FlowControl FlowControl Message []byte }
func (*ControlMessage) FromBinary ¶
func (c *ControlMessage) FromBinary(fh FixedHeader, data []byte)
func (*ControlMessage) Info ¶
func (c *ControlMessage) Info() Info
Info returns DeliveryMode and MessageID of this Message.
func (*ControlMessage) ToBinary ¶
func (c *ControlMessage) ToBinary() (bytes.Buffer, error)
ToBinary encodes the Control Message into binary data
func (*ControlMessage) Type ¶
func (c *ControlMessage) Type() MessageType
Type returns the Message type.
type Disconnect ¶
type Disconnect struct {
MessageID uint16
}
Disconnect is to signal you want to cease communications with the server
func (*Disconnect) FromBinary ¶
func (d *Disconnect) FromBinary(fh FixedHeader, data []byte)
func (*Disconnect) Info ¶
func (d *Disconnect) Info() Info
Info returns DeliveryMode and MessageID of this Message.
type FixedHeader ¶
type FixedHeader struct { MessageType MessageType FlowControl FlowControl MessageLength int }
FixedHeader
func (*FixedHeader) FromBinary ¶
func (fh *FixedHeader) FromBinary(r io.Reader) error
type FlowControl ¶
type FlowControl uint8
FlowControl represents FlowControl Message type
const ( // Flow Control NONE FlowControl = iota ACKNOWLEDGE NOTIFY RECEIVE RECEIPT COMPLETE )
type MessageType ¶
type MessageType uint8
MessageType represents a Message type
const ( // Message CONNECT MessageType = iota + 1 PUBLISH RELAY SUBSCRIBE UNSUBSCRIBE PINGREQ DISCONNECT FLOWCONTROL )
type Pingreq ¶
type Pingreq struct { }
Pingreq is a keepalive
func (*Pingreq) FromBinary ¶
func (p *Pingreq) FromBinary(fh FixedHeader, data []byte)
type Publish ¶
type Publish struct { IsForwarded bool MessageID uint16 DeliveryMode uint8 Messages []*PublishMessage }
Publish represents a publish Messages.
func (*Publish) FromBinary ¶
func (p *Publish) FromBinary(fh FixedHeader, data []byte)
type PublishMessage ¶
PublishMessage reprensents a publish Message
type Relay ¶
type Relay struct { IsForwarded bool MessageID uint16 RelayRequests []*RelayRequest }
Relay tells the server which topics and last durations the client would like get data. The Delivery Mode for relay is EXPRESS.
func (*Relay) FromBinary ¶
func (r *Relay) FromBinary(fh FixedHeader, data []byte)
type RelayRequest ¶
RelayRequest is pairing the Topic and Last parameter together
type Subscribe ¶
type Subscribe struct { IsForwarded bool MessageID uint16 Subscriptions []*Subscription }
Subscribe tells the server which topics the client would like to subscribe to
func (*Subscribe) FromBinary ¶
func (s *Subscribe) FromBinary(fh FixedHeader, data []byte)
type Subscription ¶
Subscription is a struct for pairing the delivery mode and topic together for the delivery mode's pairs in unsubscribe and subscribe
type Unsubscribe ¶
type Unsubscribe struct { IsForwarded bool MessageID uint16 Subscriptions []*Subscription }
Unsubscribe is the Message to send if you don't want to subscribe to a topic anymore
func (*Unsubscribe) FromBinary ¶
func (u *Unsubscribe) FromBinary(fh FixedHeader, data []byte)
func (*Unsubscribe) Info ¶
func (u *Unsubscribe) Info() Info
Info returns DeliveryMode and MessageID of this Message.