connection

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthParams

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

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 persistence.PersistedPackets
}

DisconnectParams session state when stopped

type Initial

type Initial interface {
	Accept() (chan interface{}, error)
	Send(mqttp.IFace) error
	Acknowledge(p *mqttp.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

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

OnAuthCb ...

type Option

type Option func(*impl) error

Option callback for connection option

func AttachSession

func AttachSession(val SessionCallbacks) Option

func KeepAlive

func KeepAlive(val int) Option

KeepAlive keep alive period

func MaxRxPacketSize

func MaxRxPacketSize(val uint32) Option

func MaxRxTopicAlias

func MaxRxTopicAlias(val uint16) Option

func MaxTxPacketSize

func MaxTxPacketSize(val uint32) Option

func MaxTxTopicAlias

func MaxTxTopicAlias(val uint16) Option

func Metric

func Metric(val systree.PacketsMetric) Option

func NetConn

func NetConn(val transport.Conn) Option

func OfflineQoS0

func OfflineQoS0(val bool) Option

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

func OnAuth

func OnAuth(val OnAuthCb) Option

func Permissions

func Permissions(val vlauth.Permissions) Option

func Persistence

func Persistence(val persistence.Packets) Option

func RetainAvailable

func RetainAvailable(val bool) Option

func RxQuota

func RxQuota(val int32) Option

func TxQuota

func TxQuota(val int32) Option

type Session

type Session interface {
	Publish(string, *mqttp.Publish)
	SetOptions(opts ...Option) error
	// contains filtered or unexported methods
}

Session ...

type SessionCallbacks

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