Documentation ¶
Index ¶
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.") )
View Source
var Default = "default"
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.
Functions ¶
func Register ¶
func Register(name string, provider SessionsProvider)
func SessionInit ¶
func SessionInit(session string)
func Unregister ¶
func Unregister(name string)
Types ¶
type Ackmsg ¶
type Ackmsg struct { // Message type of the messagev5 waiting for ack //等待ack消息的消息类型 Mtype messagev5.MessageType // Current state of the ack-waiting messagev5 //等待ack-waiting消息的当前状态 State messagev5.MessageType // Packet ID of the messagev5. Every messagev5 that require ack'ing must have a valid // packet ID. Messages that have messagev5 I //消息的包ID。每个需要ack'ing的消息必须有一个有效的 //数据包ID,包含消息I的消息 Pktid uint16 // Slice containing the messagev5 bytes //包含消息字节的片 Msgbuf []byte // Slice containing the ack messagev5 bytes //包含ack消息字节的片 Ackbuf []byte // When ack cycle completes, call this function //当ack循环完成时,调用这个函数 OnComplete interface{} }
type Session ¶
type Session interface { Init(msg *messagev5.ConnectMessage, topics ...SessionInitTopic) error Update(msg *messagev5.ConnectMessage) error AddTopic(topic string, qos byte) error RemoveTopic(topic string) error Topics() ([]string, []byte, error) ID() string // 客户端id IDs() []byte // 客户端id 字节类型的 Cmsg() *messagev5.ConnectMessage Will() *messagev5.PublishMessage Pub1ack() Ackqueue Pub2in() Ackqueue Pub2out() Ackqueue Suback() Ackqueue Unsuback() Ackqueue Pingack() Ackqueue SessionExpand }
type SessionExpand ¶
type SessionExpand interface { ExpiryInterval() uint32 Status() Status ClientId() string ReceiveMaximum() uint16 MaxPacketSize() uint32 TopicAliasMax() uint16 RequestRespInfo() byte RequestProblemInfo() byte UserProperty() []string OfflineTime() int64 SetExpiryInterval(uint32) SetStatus(Status) SetClientId(string) SetReceiveMaximum(uint16) SetMaxPacketSize(uint32) SetTopicAliasMax(uint16) SetRequestRespInfo(byte) SetRequestProblemInfo(byte) SetUserProperty([]string) SetOfflineTime(int64) SetWill(*messagev5.PublishMessage) SetSub(*messagev5.SubscribeMessage) }
type SessionInitTopic ¶
type SessionsProvider ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.