Back to godoc.org

Package connection

v0.0.4
Latest Go to latest

The highest tagged major version is .

Published: Jun 20, 2018 | License: Apache-2.0 | Module: gitee.com/kaifazhe/volantmq

Index

Variables

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

nolint: golint

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 {
	*PreConfig
	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 {
	*Config
	// 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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier