Documentation ¶
Overview ¶
Package session has code handling long-lived connections from devices.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Session ¶
func Session(conn net.Conn, brkr broker.Broker, cfg SessionConfig, track SessionTracker) error
Session manages the session with a client.
Types ¶
type SessionConfig ¶
type SessionConfig interface { // pings are emitted each ping interval PingInterval() time.Duration // send and waiting for response shouldn't take more than exchange // timeout ExchangeTimeout() time.Duration }
SessionConfig is for carrying the session configuration.
type SessionTracker ¶
type SessionTracker interface { logger.Logger // Session got started. Start(WithRemoteAddr) // SessionId SessionId() string // Session got registered with broker as sess BrokerSession. Registered(sess broker.BrokerSession) // Report effective elapsed ping interval. EffectivePingInterval(time.Duration) // Session got ended with error err (can be nil). End(error) error }
SessionTracker logs session events.
func NewTracker ¶
func NewTracker(logger logger.Logger) SessionTracker
type WithRemoteAddr ¶
WithRemoteAddr can report a remote address.
Click to show internal directories.
Click to hide internal directories.