Documentation ¶
Index ¶
- func MatchTopic(topic string) []string
- type AUTHRouter
- type BaseRouter
- type CONNECTRouter
- type Conn
- type ConnManager
- type ConnectVerifyFUNC
- type DISCONNECTRouter
- type GHapi
- func (s *GHapi) AddRouter(i uint8, router ImplBaseRouter)
- func (s *GHapi) GetConnList() *types.Response
- func (s *GHapi) GetTopList() *types.Response
- func (s *GHapi) Run()
- func (s *GHapi) SendAuth() *types.Response
- func (s *GHapi) SendPublish(msg *types.PublishMsg) *types.Response
- func (s *GHapi) ServerInfo() *types.Response
- func (s *GHapi) SetConnectVerify(cvf ConnectVerifyFUNC)
- func (s *GHapi) SetRetainMsg(msg *types.PublishMsg) *types.Response
- func (s *GHapi) Stop()
- type ImplBaseRouter
- type MqttDataPack
- type PINGREQRouter
- type PUBACKRouter
- type PUBCOMPRouter
- type PUBLISHRouter
- type PUBRECRouter
- type PUBRELRouter
- type Request
- func (s *Request) ConnStop()
- func (s *Request) GetConnClientID() string
- func (s *Request) GetProto() proto.ImplMqttProto
- func (s *Request) GetQos2ID(id uint16) bool
- func (s *Request) MsgInPool(sp *proto.PUBLISHProtocol)
- func (s *Request) RemoveQos2ID(id uint16)
- func (s *Request) SendRES(p proto.ImplMqttProto) error
- func (s *Request) SetQos2ID(id uint16)
- func (s *Request) SetRetainMsg(name string, payload []byte)
- func (s *Request) SubTopic(top string)
- func (s *Request) UnSubTopic(top string)
- type RouterManager
- type SUBSCRIBERouter
- type Server
- type TopicManager
- type TopicWork
- type UNSUBSCRIBERouter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchTopic ¶
通配符方法 参考 // https://blog.csdn.net/qq_41257365/article/details/115499403 根据主题,获得 通配符后的 多个主题列表 在根据主题列表,在订阅用户中获取订阅者,每个订阅者只获取一次
Types ¶
type CONNECTRouter ¶
type CONNECTRouter struct {
*BaseRouter
}
//////////////////////////////////////////////////////////////////////// 默认路由,可以覆盖
type ConnManager ¶
type ConnManager struct {
// contains filtered or unexported fields
}
type ConnectVerifyFUNC ¶
type ConnectVerifyFUNC func(*proto.CONNECTProtocol) uint8
定义一个方法别名,本方法在连接时候使用,仅使用一次
type GHapi ¶
type GHapi struct {
// contains filtered or unexported fields
}
func (*GHapi) SendPublish ¶
func (s *GHapi) SendPublish(msg *types.PublishMsg) *types.Response
管理服务端 直接发布信息,不能发布保留信息(保留信息使用接口 SetRetainMsg) 创造协议 管理方发布的信息直接发布,不用进入 topicmananger 的协程池
func (*GHapi) ServerInfo ¶
对http服务和管理者客户端暴露的接口,返回值都是结构体
func (*GHapi) SetRetainMsg ¶
func (s *GHapi) SetRetainMsg(msg *types.PublishMsg) *types.Response
设置保留消息
type ImplBaseRouter ¶
type PUBCOMPRouter ¶
type PUBCOMPRouter struct {
*BaseRouter
}
默认
func (*PUBCOMPRouter) Handle ¶
func (s *PUBCOMPRouter) Handle(request *Request)
业务方可以解析 标识符合发布的标识符对应
type PUBLISHRouter ¶
type PUBLISHRouter struct {
*BaseRouter
}
默认 发布协议
func (*PUBLISHRouter) Handle ¶
func (s *PUBLISHRouter) Handle(request *Request)
type PUBRECRouter ¶
type PUBRECRouter struct {
*BaseRouter
}
默认
func (*PUBRECRouter) Handle ¶
func (s *PUBRECRouter) Handle(request *Request)
业务方可以解析 标识符合发布的标识符对应
返回 PUBRELProtocol
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
服务-链接-请求,请求是主要的操作入口,
func (*Request) GetConnClientID ¶
func (*Request) GetProto ¶
func (s *Request) GetProto() proto.ImplMqttProto
func (*Request) MsgInPool ¶
func (s *Request) MsgInPool(sp *proto.PUBLISHProtocol)
func (*Request) RemoveQos2ID ¶
func (*Request) SetRetainMsg ¶
优化后的 保存保留消息
type RouterManager ¶
type RouterManager struct {
// contains filtered or unexported fields
}
每种协议,都有对应的路由处理 每种协议,可以设置 前置中间件,路由业务,后置中间件
根据发布和订阅主题不同,这个业务在业务层处理,不在基础服务层
type SUBSCRIBERouter ¶
type SUBSCRIBERouter struct {
*BaseRouter
}
默认订阅协议路由
func (*SUBSCRIBERouter) Handle ¶
func (s *SUBSCRIBERouter) Handle(request *Request)
type TopicManager ¶
type TopicManager struct {
// contains filtered or unexported fields
}
主题管理对象 在配置中选择使用
type UNSUBSCRIBERouter ¶
type UNSUBSCRIBERouter struct {
*BaseRouter
}
默认 取消订阅协议路由
func (*UNSUBSCRIBERouter) Handle ¶
func (s *UNSUBSCRIBERouter) Handle(request *Request)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.