server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleConnection

func HandleConnection(conn *ConBroker)

HandleConnection 处理句柄

Types

type Broker

type Broker interface {
	ListenAndServe(string) error
	Listener() network.IListener
	Serve() error
	Shutdown()
}

Broker mqtt服务主框架

type ConBroker

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

ConBroker 连接器

func NewBrokerConn

func NewBrokerConn() *ConBroker

NewBrokerConn 创建一个连接器

func (*ConBroker) Close

func (slf *ConBroker) Close() error

Close 关闭连接器

func (*ConBroker) Debug

func (slf *ConBroker) Debug(fmt string, args ...interface{})

Debug 输出等级为Debug的日志

func (*ConBroker) Error

func (slf *ConBroker) Error(fmt string, args ...interface{})

Error 输出等级为Error的日志

func (*ConBroker) GetAddr

func (slf *ConBroker) GetAddr() string

GetAddr 返回连接者地址

func (*ConBroker) GetID

func (slf *ConBroker) GetID() int64

GetID 返回ID

func (*ConBroker) GetSession

func (slf *ConBroker) GetSession() *sessions.Session

GetSession 返回关联的session对象

func (*ConBroker) Info

func (slf *ConBroker) Info(fmt string, args ...interface{})

Info 输出等级为Info的日志

func (*ConBroker) Kicker

func (slf *ConBroker) Kicker()

Kicker 处理心跳

func (*ConBroker) ParseMessage

func (slf *ConBroker) ParseMessage() (message.Message, error)

ParseMessage 解析消息

func (*ConBroker) Ping

func (slf *ConBroker) Ping()

Ping 发送Ping给客户端

func (*ConBroker) SendPublishMessage

func (slf *ConBroker) SendPublishMessage(msg *message.Publish)

SendPublishMessage 发送publish消息

func (*ConBroker) Terminate

func (slf *ConBroker) Terminate()

Terminate 终止连接器

func (*ConBroker) Warning

func (slf *ConBroker) Warning(fmt string, args ...interface{})

Warning 输出等级为Warning的日志

func (*ConBroker) Will

func (slf *ConBroker) Will()

Will 发送遗嘱消息

func (*ConBroker) WithAddr

func (slf *ConBroker) WithAddr(remote string)

WithAddr 设置连接者地址

func (*ConBroker) WithConn

func (slf *ConBroker) WithConn(conn io.ReadWriteCloser)

WithConn 设置连接器关键通信句柄

func (*ConBroker) WithID

func (slf *ConBroker) WithID(id int64)

WithID 设置ID

func (*ConBroker) WithSession

func (slf *ConBroker) WithSession(session *sessions.Session)

WithSession 设置session对象

func (*ConBroker) WriteMessage

func (slf *ConBroker) WriteMessage(msg message.Message) error

WriteMessage 写入消息

type TCPBroker

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

TCPBroker mqtt tcp 服务

func (*TCPBroker) Debug

func (slf *TCPBroker) Debug(fmt string, args ...interface{})

Debug 输出等级为Debug的日志

func (*TCPBroker) Error

func (slf *TCPBroker) Error(fmt string, args ...interface{})

Error 输出等级为Error的日志

func (*TCPBroker) Info

func (slf *TCPBroker) Info(fmt string, args ...interface{})

Info 输出等级为Info的日志

func (*TCPBroker) ListenAndServe

func (slf *TCPBroker) ListenAndServe(address string) error

ListenAndServe 启动监听并启动服务

func (*TCPBroker) Listener

func (slf *TCPBroker) Listener() network.IListener

Listener listener

func (*TCPBroker) Serve

func (slf *TCPBroker) Serve() error

Serve 服务逻辑

func (*TCPBroker) Shutdown

func (slf *TCPBroker) Shutdown()

Shutdown 关闭mqtt tcp服务

func (*TCPBroker) Warning

func (slf *TCPBroker) Warning(fmt string, args ...interface{})

Warning 输出等级为Warning的日志

Jump to

Keyboard shortcuts

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