v0.0.4 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2018 License: Apache-2.0 Imports: 23 Imported by: 0




This section is empty.


View Source
var (
	ErrOverflow    = errors.New("session: overflow")
	ErrPersistence = errors.New("session: error during persistence restore")

nolint: golint


This section is empty.


type Callbacks

type Callbacks struct {
	// OnStop called when session stopped net connection and should be either suspended or deleted
	OnStop func(string, bool)

Callbacks provided by sessions manager to signal session state

type Config

type Config struct {
	ID               string
	Subscriber       subscriber.ConnectionProvider
	Messenger        types.TopicMessenger
	OnDisconnect     onDisconnect
	ExpireIn         *uint32
	WillDelay        uint32
	KillOnDisconnect bool

Config is system wide configuration parameters for every session

type DisconnectParams

type DisconnectParams struct {
	ExpireAt *uint32
	Desc     *netpoll.Desc
	Reason   packet.ReasonCode
	Will     bool

DisconnectParams session state when stopped

type PreConfig

type PreConfig struct {
	EventPoll        netpoll.EventPoll
	Username         string
	AuthMethod       string
	AuthData         []byte
	PersistedSession persistence.Sessions
	Metric           systree.Metric
	Conn             net.Conn
	Auth             auth.SessionPermissions
	Desc             *netpoll.Desc
	MaxRxPacketSize  uint32
	MaxTxPacketSize  uint32
	SendQuota        int32
	MaxTxTopicAlias  uint16
	MaxRxTopicAlias  uint16
	KeepAlive        uint16
	Version          packet.ProtocolVersion
	RetainAvailable  bool
	PreserveOrder    bool
	OfflineQoS0      bool

PreConfig used by session manager to when configuring session a bit of ugly TODO(troian): try rid it off

type Type

type Type struct {
	// contains filtered or unexported fields

Type connection

func New

func New(c *Config) (s *Type, err error)

New allocate new connection object

func (*Type) Start

func (s *Type) Start()

Start run connection

func (*Type) Stop

func (s *Type) Stop(reason packet.ReasonCode)

Stop session. Function assumed to be invoked once server about to either shutdown, disconnect or session is being replaced Effective only first invoke

type WillConfig

type WillConfig struct {
	Topic   string
	Message []byte
	Retain  bool
	QoS     packet.QosType

WillConfig configures session for will messages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL