clients

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: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrReplaceNotAllowed case when new client with existing ID connected
	ErrReplaceNotAllowed = errors.New("duplicate not allowed")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// Topics manager for all the client subscriptions
	TopicsMgr topicsTypes.Provider

	Persist persistenceTypes.Provider

	Systree systree.Provider

	// OnReplaceAttempt If requested we notify if there is attempt to dup session
	OnReplaceAttempt func(string, bool)

	NodeName string

	// The number of seconds to wait for the CONNACK message before disconnecting.
	// If not set then default to 2 seconds.
	ConnectTimeout int

	// The number of seconds to keep the connection live if there's no data.
	// If not set then defaults to 5 minutes.
	KeepAlive int

	// AllowReplace Either allow or deny replacing of existing session if there new client with same clientID
	AllowReplace bool

	OfflineQoS0 bool
}

Config manager configuration

type Manager

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

Manager clients manager

func NewManager

func NewManager(c *Config) (*Manager, error)

NewManager create new clients manager

func (*Manager) NewSession

func (m *Manager) NewSession(config *StartConfig)

NewSession create new session with provided established connection This is god function. Might be try split it

func (*Manager) Shutdown

func (m *Manager) Shutdown() error

Shutdown clients manager gracefully shutdown by stopping all active sessions and persist states

type StartConfig

type StartConfig struct {
	Req  *packet.Connect
	Resp *packet.ConnAck
	Conn net.Conn
	Auth auth.SessionPermissions
}

StartConfig used to configure session after connection is created

Jump to

Keyboard shortcuts

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