connection

package
Version: v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2018 License: Apache-2.0 Imports: 20 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 AuthParams added in v0.0.4

type AuthParams struct {
	AuthMethod string
	AuthData   []byte
	Reason     packet.ReasonCode
}

AuthParams ...

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 ConnectParams added in v0.0.4

type ConnectParams struct {
	AuthParams
	ID              string
	Error           error
	ExpireIn        *uint32
	Will            *packet.Publish
	Username        []byte
	Password        []byte
	WillDelay       uint32
	MaxTxPacketSize uint32
	SendQuota       uint16
	KeepAlive       uint16
	IDGen           bool
	CleanStart      bool
	Durable         bool
	Version         packet.ProtocolVersion
}

ConnectParams ...

type DisconnectParams

type DisconnectParams struct {
	Reason  packet.ReasonCode
	Packets persistence.PersistedPackets
}

DisconnectParams session state when stopped

type Initial added in v0.0.4

type Initial interface {
	Accept() (chan interface{}, error)
	Send(packet.Provider) error
	Acknowledge(p *packet.ConnAck, opts ...Option) bool
	Session() Session
	// contains filtered or unexported methods
}

Initial ...

func New

func New(opts ...Option) Initial

New allocate new connection object

type OnAuthCb added in v0.0.4

type OnAuthCb func(string, *AuthParams) (packet.Provider, error)

type Option added in v0.0.4

type Option func(*impl) error

func AttachSession added in v0.0.4

func AttachSession(val SessionCallbacks) Option

func KeepAlive added in v0.0.4

func KeepAlive(val int) Option

func MaxRxPacketSize added in v0.0.4

func MaxRxPacketSize(val uint32) Option

func MaxRxTopicAlias added in v0.0.4

func MaxRxTopicAlias(val uint16) Option

func MaxTxPacketSize added in v0.0.4

func MaxTxPacketSize(val uint32) Option

func MaxTxTopicAlias added in v0.0.4

func MaxTxTopicAlias(val uint16) Option

func Metric added in v0.0.4

func Metric(val systree.PacketsMetric) Option

func NetConn added in v0.0.4

func NetConn(val transport.Conn) Option

func OfflineQoS0 added in v0.0.4

func OfflineQoS0(val bool) Option

func OnAuth added in v0.0.4

func OnAuth(val OnAuthCb) Option

func RetainAvailable added in v0.0.4

func RetainAvailable(val bool) Option

func RxQuota added in v0.0.4

func RxQuota(val int32) Option

func TxQuota added in v0.0.4

func TxQuota(val int32) Option

type Session added in v0.0.4

type Session interface {
	persistence.PacketLoader
	Publish(string, *packet.Publish)
	LoadRemaining(g, q *list.List)
	SetOptions(opts ...Option) error
	Start() error
	// contains filtered or unexported methods
}

Session ...

type SessionCallbacks added in v0.0.4

type SessionCallbacks interface {
	SignalPublish(*packet.Publish) error
	SignalSubscribe(*packet.Subscribe) (packet.Provider, error)
	SignalUnSubscribe(*packet.UnSubscribe) (packet.Provider, error)
	SignalDisconnect(*packet.Disconnect) (packet.Provider, error)
	SignalOffline()
	SignalConnectionClose(DisconnectParams)
}

SessionCallbacks ...

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