connection

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 22 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConnectionNack connection has not passed requirements and was rejected
	ErrConnectionNack = errors.New("connection: nack")
)

Functions

This section is empty.

Types

type AuthParams added in v0.0.4

type AuthParams struct {
	AuthMethod string
	AuthData   []byte
	Reason     mqttp.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            *mqttp.Publish
	Username        []byte
	Password        []byte
	MaxTxPacketSize uint32
	SendQuota       uint16
	KeepAlive       uint16
	IDGen           bool
	CleanStart      bool
	Durable         bool
	Version         mqttp.ProtocolVersion
}

ConnectParams ...

type DisconnectParams

type DisconnectParams struct {
	Reason  mqttp.ReasonCode
	Packets vlpersistence.PersistedPackets
}

DisconnectParams session state when stopped

type Initial added in v0.0.4

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

Initial ...

func New

func New(opts ...Option) (Initial, error)

New allocate new connection object

type OnAuthCb added in v0.0.4

type OnAuthCb func(string, *AuthParams) (mqttp.IFace, error)

OnAuthCb ...

type Option added in v0.0.4

type Option func(*impl) error

Option callback for connection option

func AttachSession added in v0.0.4

func AttachSession(val SessionCallbacks) Option

func KeepAlive added in v0.0.4

func KeepAlive(val int) Option

KeepAlive keep alive period

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

OfflineQoS0 if true QoS0 messages will be persisted when session is offline and durable

func OnAuth added in v0.0.4

func OnAuth(val OnAuthCb) Option

func Permissions added in v0.2.4

func Permissions(val vlauth.Permissions) Option

func Persistence added in v0.1.1

func Persistence(val vlpersistence.Packets) 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 {
	Publish(string, *mqttp.Publish)
	SetOptions(opts ...Option) error
	// contains filtered or unexported methods
}

Session ...

type SessionCallbacks added in v0.0.4

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

SessionCallbacks ...

type WillConfig

type WillConfig struct {
	Topic   string
	Message []byte
	Retain  bool
	QoS     mqttp.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