Documentation
¶
Overview ¶
Copyright 2014 loolgame Author. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 与客户端通信的自定义粘包示例,需要mqant v1.6.4版本以上才能运行 该示例只用于简单的演示,并没有实现具体的粘包协议
* 一定要记得在confin.json配置这个模块的参数,否则无法使用
Index ¶
- Variables
- type CustomAgent
- func (this *CustomAgent) Close()
- func (this *CustomAgent) Destroy()
- func (this *CustomAgent) GetSession() gate.Session
- func (this *CustomAgent) IsClosed() bool
- func (this *CustomAgent) OnClose() error
- func (this *CustomAgent) OnInit(gate gate.Gate, conn network.Conn) error
- func (this *CustomAgent) OnRecover(topic string, msg []byte)
- func (this *CustomAgent) RevNum() int64
- func (this *CustomAgent) Run() (err error)
- func (this *CustomAgent) SendNum() int64
- func (this *CustomAgent) WriteMsg(topic string, body []byte) error
- type Gate
- func (this *Gate) Connect(session gate.Session)
- func (gate *Gate) Delete(session gate.Session) (err error)
- func (this *Gate) DisConnect(session gate.Session)
- func (this *Gate) GetType() string
- func (gate *Gate) Heartbeat(session gate.Session)
- func (this *Gate) OnInit(app module.App, settings *conf.ModuleSettings)
- func (gate *Gate) OnRequestTracing(session gate.Session, topic string, msg []byte) bool
- func (gate *Gate) Query(Userid string) ([]byte, error)
- func (gate *Gate) Storage(session gate.Session) (err error)
- func (this *Gate) Version() string
Constants ¶
This section is empty.
Variables ¶
var Module = func() module.Module { gate := new(Gate) return gate }
Functions ¶
This section is empty.
Types ¶
type CustomAgent ¶
func NewAgent ¶
func NewAgent(module module.RPCModule) *CustomAgent
func (*CustomAgent) Close ¶
func (this *CustomAgent) Close()
func (*CustomAgent) Destroy ¶
func (this *CustomAgent) Destroy()
func (*CustomAgent) GetSession ¶
func (this *CustomAgent) GetSession() gate.Session
func (*CustomAgent) IsClosed ¶
func (this *CustomAgent) IsClosed() bool
func (*CustomAgent) OnClose ¶
func (this *CustomAgent) OnClose() error
func (*CustomAgent) OnRecover ¶
func (this *CustomAgent) OnRecover(topic string, msg []byte)
* 接收到一个数据包
func (*CustomAgent) RevNum ¶
func (this *CustomAgent) RevNum() int64
func (*CustomAgent) Run ¶
func (this *CustomAgent) Run() (err error)
func (*CustomAgent) SendNum ¶
func (this *CustomAgent) SendNum() int64
type Gate ¶
type Gate struct {
basegate.Gate //继承
}
func (*Gate) DisConnect ¶
当连接关闭 或者客户端主动发送MQTT DisConnect命令 ,这个函数中Session无法再继续后续的设置操作,只能读取部分配置内容了
func (*Gate) OnRequestTracing ¶
* 是否需要对本次客户端请求进行跟踪