Documentation ¶
Index ¶
- Variables
- func NewMemProvider() *memProvider
- func Register(name string, provider SessionsProvider)
- func Unregister(name string)
- type Ackqueue
- type Manager
- type Session
- func (this *Session) AddTopic(topic string, qos byte) error
- func (this *Session) HasTopics(name string) bool
- func (this *Session) ID() string
- func (this *Session) Init(msg *message.ConnectMessage) error
- func (this *Session) RemoveTopic(topic string) error
- func (this *Session) RetainMessage(msg *message.PublishMessage) error
- func (this *Session) Topics() ([]string, []byte, error)
- func (this *Session) Update(msg *message.ConnectMessage) error
- type SessionsProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSessionsProviderNotFound = errors.New("Session: Session provider not found") ErrKeyNotAvailable = errors.New("Session: not item found for key.") )
Functions ¶
func NewMemProvider ¶
func NewMemProvider() *memProvider
func Register ¶
func Register(name string, provider SessionsProvider)
Register makes a session provider available by the provided name. If a Register is called twice with the same name or if the driver is nil, it panics.
func Unregister ¶
func Unregister(name string)
Types ¶
type Ackqueue ¶
type Ackqueue struct {
// contains filtered or unexported fields
}
Ackqueue is a growing queue implemented based on a ring buffer. As the buffer gets full, it will auto-grow.
Ackqueue is used to store messages that are waiting for acks to come back. There are a few scenarios in which acks are required.
- Client sends SUBSCRIBE message to server, waits for SUBACK.
- Client sends UNSUBSCRIBE message to server, waits for UNSUBACK.
- Client sends PUBLISH QoS 1 message to server, waits for PUBACK.
- Server sends PUBLISH QoS 1 message to client, waits for PUBACK.
- Client sends PUBLISH QoS 2 message to server, waits for PUBREC.
- Server sends PUBREC message to client, waits for PUBREL.
- Client sends PUBREL message to server, waits for PUBCOMP.
- Server sends PUBLISH QoS 2 message to client, waits for PUBREC.
- Client sends PUBREC message to server, waits for PUBREL.
- Server sends PUBREL message to client, waits for PUBCOMP.
- Client sends PINGREQ message to server, waits for PINGRESP.
func (*Ackqueue) Ack ¶
Ack() takes the ack message supplied and updates the status of messages waiting.
type Session ¶
type Session struct { // Ack queue for outgoing PUBLISH QoS 1 messages Pub1ack *Ackqueue // Ack queue for incoming PUBLISH QoS 2 messages Pub2in *Ackqueue // Ack queue for outgoing PUBLISH QoS 2 messages Pub2out *Ackqueue // Ack queue for outgoing SUBSCRIBE messages Suback *Ackqueue // Ack queue for outgoing UNSUBSCRIBE messages Unsuback *Ackqueue // Ack queue for outgoing PINGREQ messages Pingack *Ackqueue // cmsg is the CONNECT message Cmsg *message.ConnectMessage // Will message to publish if connect is closed unexpectedly Will *message.PublishMessage // Retained publish message Retained *message.PublishMessage //client ID Id string //Enctrypt key AesKey []byte // contains filtered or unexported fields }
func (*Session) RemoveTopic ¶
func (*Session) RetainMessage ¶
func (this *Session) RetainMessage(msg *message.PublishMessage) error
Click to show internal directories.
Click to hide internal directories.