connection

package
v0.0.2-beta Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

nolint: golint

Functions

This section is empty.

Types

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
	Username      string
	State         *persistenceTypes.SessionMessages
	Subscriber    subscriber.ConnectionProvider
	Auth          auth.SessionPermissions
	Messenger     types.TopicMessenger
	Metric        systree.Metric
	Conn          net.Conn
	OnDisconnect  onDisconnect
	ExpireIn      *time.Duration
	WillDelay     time.Duration
	KeepAlive     uint16
	SendQuota     uint16
	Clean         bool
	PreserveOrder bool
	Version       packet.ProtocolVersion
}

Config is system wide configuration parameters for every session

type DisconnectParams

type DisconnectParams struct {
	Will     bool
	ExpireAt *time.Duration
	State    *persistenceTypes.SessionMessages
}

DisconnectParams session state when stopped

type Type

type Type struct {
	// contains filtered or unexported fields
}

Type session

func New

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

New allocate new sessions 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