Documentation
¶
Overview ¶
Package model definition of general structures
Index ¶
- Constants
- func SessionExpired(lastSeen int64, expiryInterval int64) bool
- type Client
- type Connections
- type Engine
- type Message
- type Packet
- type Retain
- type Retry
- type Router
- type RunningSession
- func (s *RunningSession) ApplyAcl(pubAcl string, subAcl string)
- func (s *RunningSession) ApplySessionId(sessionID int64)
- func (s *RunningSession) CleanStart() bool
- func (s *RunningSession) Expired() bool
- func (s *RunningSession) GetClientId() string
- func (s *RunningSession) GetConn() TagyouConn
- func (s *RunningSession) GetConnected() bool
- func (s *RunningSession) GetExpiryInterval() int64
- func (s *RunningSession) GetId() int64
- func (s *RunningSession) GetKeepAlive() int
- func (s *RunningSession) GetLastConnect() int64
- func (s *RunningSession) GetLastSeen() int64
- func (s *RunningSession) GetProtocolVersion() uint8
- func (s *RunningSession) HavePass() bool
- func (s *RunningSession) HaveUser() bool
- func (s *RunningSession) ReservedBit() bool
- func (s *RunningSession) SetConnected(connected bool)
- func (s *RunningSession) WillFlag() bool
- func (s *RunningSession) WillQoS() uint8
- func (s *RunningSession) WillRetain() bool
- type Session
- func (s Session) Expired() bool
- func (s Session) GetClientId() string
- func (s Session) GetConnected() bool
- func (s Session) GetExpiryInterval() int64
- func (s Session) GetId() int64
- func (s Session) GetLastConnect() int64
- func (s Session) GetLastSeen() int64
- func (s Session) GetProtocolVersion() uint8
- type SimpleConnections
- type Subscription
- type SubscriptionGroup
- type TagyouConn
- type User
- type WebsocketConnection
Constants ¶
View Source
const WAIT_FOR_PUB_ACK = 10
qos 1
View Source
const WAIT_FOR_PUB_COMP = 21
View Source
const WAIT_FOR_PUB_REC = 20
qos 2
View Source
const WAIT_FOR_PUB_REL = 20
Variables ¶
This section is empty.
Functions ¶
func SessionExpired ¶
Types ¶
type Connections ¶
type Connections interface {
Add(clientId string, conn TagyouConn)
Exists(clientId string) (TagyouConn, bool)
Close(clientId string) error
Remove(clientId string)
}
type Engine ¶
type Engine interface {
OnConnect(session *RunningSession)
OnPing(session *RunningSession)
OnSubscribe(session *RunningSession, p Packet)
OnUnsubscribe(session *RunningSession, p Packet)
OnPublish(session *RunningSession, p Packet)
OnClientPuback(session *RunningSession, p Packet)
OnClientPubrec(session *RunningSession, p Packet)
OnClientPubrel(session *RunningSession, p Packet)
OnClientPubcomp(clientId string, packetIdentifier int, reasonCode uint8)
OnClientDisconnect(session *RunningSession, clientId string)
// connection status
OnSocketUpButSilent(session *RunningSession) bool
OnSocketDownClosed(session *RunningSession) bool
}
type Retry ¶
type Router ¶
type Router interface {
Send(clientId string, payload []byte)
Forward(senderId string, topic string, packet Packet)
SendRetain(protocolVersion uint8, subscription Subscription)
AddDestination(clientId string, conn TagyouConn)
RemoveDestination(clientId string)
DestinationExists(clientId string) bool
GetConns() Connections
}
type RunningSession ¶
type RunningSession struct {
ID int64
SessionID int64
ClientId string
ProtocolVersion uint8
LastSeen int64
LastConnect int64
Connected bool
ExpiryInterval int64
ConnectFlags uint8
KeepAlive int
WillTopic string
WillDelay int64
WillMessage []byte
Username string
Password string
SubscribeAcl string
PublishAcl string
Router Router
Engine Engine
Conn TagyouConn
Mu sync.RWMutex
}
func (*RunningSession) ApplyAcl ¶
func (s *RunningSession) ApplyAcl(pubAcl string, subAcl string)
func (*RunningSession) ApplySessionId ¶
func (s *RunningSession) ApplySessionId(sessionID int64)
func (*RunningSession) CleanStart ¶
func (s *RunningSession) CleanStart() bool
func (*RunningSession) Expired ¶
func (s *RunningSession) Expired() bool
func (*RunningSession) GetClientId ¶
func (s *RunningSession) GetClientId() string
func (*RunningSession) GetConn ¶
func (s *RunningSession) GetConn() TagyouConn
func (*RunningSession) GetConnected ¶
func (s *RunningSession) GetConnected() bool
func (*RunningSession) GetExpiryInterval ¶
func (s *RunningSession) GetExpiryInterval() int64
func (*RunningSession) GetId ¶
func (s *RunningSession) GetId() int64
func (*RunningSession) GetKeepAlive ¶
func (s *RunningSession) GetKeepAlive() int
func (*RunningSession) GetLastConnect ¶
func (s *RunningSession) GetLastConnect() int64
func (*RunningSession) GetLastSeen ¶
func (s *RunningSession) GetLastSeen() int64
func (*RunningSession) GetProtocolVersion ¶
func (s *RunningSession) GetProtocolVersion() uint8
func (*RunningSession) HavePass ¶
func (s *RunningSession) HavePass() bool
func (*RunningSession) HaveUser ¶
func (s *RunningSession) HaveUser() bool
func (*RunningSession) ReservedBit ¶
func (s *RunningSession) ReservedBit() bool
func (*RunningSession) SetConnected ¶
func (s *RunningSession) SetConnected(connected bool)
func (*RunningSession) WillFlag ¶
func (s *RunningSession) WillFlag() bool
func (*RunningSession) WillQoS ¶
func (s *RunningSession) WillQoS() uint8
func (*RunningSession) WillRetain ¶
func (s *RunningSession) WillRetain() bool
type Session ¶
type Session struct {
ID int64
LastSeen int64
LastConnect int64
ExpiryInterval int64
ClientId string
Connected bool
ProtocolVersion uint8
}
func (Session) GetClientId ¶
func (Session) GetConnected ¶
func (Session) GetExpiryInterval ¶
func (Session) GetLastConnect ¶
func (Session) GetLastSeen ¶
func (Session) GetProtocolVersion ¶
type SimpleConnections ¶
type SimpleConnections struct {
Conns map[string]TagyouConn
Mu sync.RWMutex
}
func (*SimpleConnections) Add ¶
func (c *SimpleConnections) Add(clientId string, conn TagyouConn)
func (*SimpleConnections) Close ¶
func (c *SimpleConnections) Close(clientId string) error
func (*SimpleConnections) Exists ¶
func (c *SimpleConnections) Exists(clientId string) (TagyouConn, bool)
func (*SimpleConnections) Remove ¶
func (c *SimpleConnections) Remove(clientId string)
type Subscription ¶
type SubscriptionGroup ¶
type SubscriptionGroup map[string][]Subscription
type TagyouConn ¶
type WebsocketConnection ¶
func (WebsocketConnection) Close ¶
func (c WebsocketConnection) Close() error
func (WebsocketConnection) RemoteAddr ¶
func (c WebsocketConnection) RemoteAddr() net.Addr
Click to show internal directories.
Click to hide internal directories.