listener

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2018 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSessionDisconnected = errors.New("session disconnected")
)

Functions

func New

func New(handler Handler) (io.Closer, chan<- Transport)

Types

type Handler

type Handler interface {
	Authenticate(transport Transport, sessionID, username string, password string) (tenant string, id string, err error)
	OnConnect(id, tenant string, sess *Session, transport string)
	OnSubscribe(id string, tenant string, packet *packet.Subscribe) error
	OnUnsubscribe(id string, tenant string, packet *packet.Unsubscribe) error
	OnSessionClosed(id, tenant string)
	OnSessionLost(id, tenant string)
	OnPublish(id, tenant string, packet *packet.Publish) error
}

type Session

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

func (*Session) Channel

func (s *Session) Channel() chan<- *packet.Publish

func (*Session) Close

func (s *Session) Close() error

func (*Session) Connect

func (s *Session) Connect() *packet.Connect

type TimeoutReadWriteCloser

type TimeoutReadWriteCloser interface {
	SetDeadline(time.Time) error
	io.ReadWriteCloser
}

type Transport

type Transport interface {
	io.Closer
	Name() string
	Encrypted() bool
	EncryptionState() *tls.ConnectionState
	Channel() TimeoutReadWriteCloser
	RemoteAddress() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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