gateway.module命名修改

This commit is contained in:
wnp 2022-06-29 13:49:55 +08:00
parent 19a1ef270f
commit f463f686ab

View File

@ -22,8 +22,8 @@ func NewModule() core.IModule {
type Gateway struct { type Gateway struct {
modules.ModuleBase modules.ModuleBase
service base.IRPCXService service base.IRPCXService
wsservice *WSServiceComp //websocket 服务组件 提供websocket服务监听 wsService *WSServiceComp //websocket 服务组件 提供websocket服务监听
agentmgr *AgentMgrComp //用户代理对象管理组件 管理用户socekt对象 agentMgr *AgentMgrComp //用户代理对象管理组件 管理用户socekt对象
configure *configureComp configure *configureComp
} }
@ -52,17 +52,17 @@ func (this *Gateway) Init(service core.IService, module core.IModule, options co
//模块启动函数 注册rpc服务接口提供用户相关的rpc接口服务 //模块启动函数 注册rpc服务接口提供用户相关的rpc接口服务
func (this *Gateway) Start() (err error) { func (this *Gateway) Start() (err error) {
//注册用户绑定uid接口 登录成功后触发 //注册用户绑定uid接口 登录成功后触发
this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentBind), this.agentmgr.Bind) this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentBind), this.agentMgr.Bind)
//注册用户解绑uid接口 登出或则切换账号是触发 //注册用户解绑uid接口 登出或则切换账号是触发
this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentUnBind), this.agentmgr.UnBind) this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentUnBind), this.agentMgr.UnBind)
//向用户发送消息接口 //向用户发送消息接口
this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentSendMsg), this.agentmgr.SendMsgToAgent) this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentSendMsg), this.agentMgr.SendMsgToAgent)
//向多个用户对象发送消息接口 //向多个用户对象发送消息接口
this.service.RegisterFunctionName(string(comm.Rpc_GatewaySendBatchMsg), this.agentmgr.SendMsgToAgents) this.service.RegisterFunctionName(string(comm.Rpc_GatewaySendBatchMsg), this.agentMgr.SendMsgToAgents)
//向所有用户发送消息接口 //向所有用户发送消息接口
this.service.RegisterFunctionName(string(comm.Rpc_GatewaySendRadioMsg), this.agentmgr.SendMsgToAllAgent) this.service.RegisterFunctionName(string(comm.Rpc_GatewaySendRadioMsg), this.agentMgr.SendMsgToAllAgent)
//关闭用户socket连接接口 //关闭用户socket连接接口
this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentClose), this.agentmgr.CloseAgent) this.service.RegisterFunctionName(string(comm.Rpc_GatewayAgentClose), this.agentMgr.CloseAgent)
err = this.ModuleBase.Start() err = this.ModuleBase.Start()
return return
} }
@ -70,21 +70,21 @@ func (this *Gateway) Start() (err error) {
//装备组件 //装备组件
func (this *Gateway) OnInstallComp() { func (this *Gateway) OnInstallComp() {
this.ModuleBase.OnInstallComp() this.ModuleBase.OnInstallComp()
this.agentmgr = this.RegisterComp(new(AgentMgrComp)).(*AgentMgrComp) this.agentMgr = this.RegisterComp(new(AgentMgrComp)).(*AgentMgrComp)
this.wsservice = this.RegisterComp(new(WSServiceComp)).(*WSServiceComp) this.wsService = this.RegisterComp(new(WSServiceComp)).(*WSServiceComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp) this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
} }
//有新的连接对象进入 //有新的连接对象进入
func (this *Gateway) Connect(a IAgent) { func (this *Gateway) Connect(a IAgent) {
log.Debugf("[Module.Gateway] have new connect:Ip[%s] SessionId:[%s]", a.IP(), a.SessionId()) log.Debugf("[Module.Gateway] have new connect:Ip[%s] SessionId:[%s]", a.IP(), a.SessionId())
this.agentmgr.Connect(a) this.agentMgr.Connect(a)
} }
//有用户断开连接 //有用户断开连接
func (this *Gateway) DisConnect(a IAgent) { func (this *Gateway) DisConnect(a IAgent) {
log.Debugf("[Module.Gateway] have disConnect:Ip[%s] SessionId:[%s] uid:[%s]", a.IP(), a.SessionId(), a.UserId()) log.Debugf("[Module.Gateway] have disConnect:Ip[%s] SessionId:[%s] uid:[%s]", a.IP(), a.SessionId(), a.UserId())
this.agentmgr.DisConnect(a) this.agentMgr.DisConnect(a)
} }
//读取消息分发规则 //读取消息分发规则