上传RPC 服务定义

This commit is contained in:
liwei1dao 2022-05-31 17:08:25 +08:00
parent e394fc8e44
commit ae8827b476
5 changed files with 11 additions and 4 deletions

View File

@ -16,7 +16,12 @@ const (
) )
const ( //Rpc const ( //Rpc
Rpc_GateRoute core.Rpc_Key = "Rpc_GateRoute" //网关路由 Rpc_GatewayRoute core.Rpc_Key = "Rpc_GatewayRoute" //网关路由
Rpc_GatewayAgentBuild core.Rpc_Key = "Rpc_GatewayAgentBuild" //代理绑定 绑定用户Id
Rpc_GatewayAgentUnBuild core.Rpc_Key = "Rpc_GatewayAgentUnBuild" //代理解绑 解绑用户Id
Rpc_GatewayAgentSendMsg core.Rpc_Key = "Rpc_GatewayAgentSendMsg" //代理发送消息 向用户发送消息
Rpc_GatewayAgentRadioMsg core.Rpc_Key = "Rpc_GatewayAgentRadioMsg" //代理广播消息 向所有在线用户发送消息
Rpc_GatewayAgentClose core.Rpc_Key = "Rpc_GatewayAgentClose" //代理关闭 关闭用户连接
) )
type ISC_GateRouteComp interface { type ISC_GateRouteComp interface {

2
go.mod
View File

@ -114,4 +114,4 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
) )
replace github.com/liwei1dao/lego => F:\work\go\lego // replace github.com/liwei1dao/lego => F:\work\go\lego

2
go.sum
View File

@ -516,6 +516,8 @@ github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/linkedin/goavro/v2 v2.9.8/go.mod h1:UgQUb2N/pmueQYH9bfqFioWxzYCZXSfF8Jw03O5sjqA= github.com/linkedin/goavro/v2 v2.9.8/go.mod h1:UgQUb2N/pmueQYH9bfqFioWxzYCZXSfF8Jw03O5sjqA=
github.com/liwei1dao/dm v0.0.0-20211103094420-938edf103cf0/go.mod h1:YH8wwRWv57a88ZbPtflEhwCQDrcm9L9S8wl9y1m8SnQ= github.com/liwei1dao/dm v0.0.0-20211103094420-938edf103cf0/go.mod h1:YH8wwRWv57a88ZbPtflEhwCQDrcm9L9S8wl9y1m8SnQ=
github.com/liwei1dao/lego v0.0.0-20220531033739-03f821663a48 h1:w7VgcKpPNonCD6rz915LLygN88BJCNMudB/TOFdCD/4=
github.com/liwei1dao/lego v0.0.0-20220531033739-03f821663a48/go.mod h1:eEEe2/9fK64Bo1Mj30Hwdt5BZ8IwKbZ6ZMgCTu8DQ+4=
github.com/lucas-clemente/quic-go v0.24.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0= github.com/lucas-clemente/quic-go v0.24.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0=
github.com/lucas-clemente/quic-go v0.27.0 h1:v6WY87q9zD4dKASbG8hy/LpzAVNzEQzw8sEIeloJsc4= github.com/lucas-clemente/quic-go v0.27.0 h1:v6WY87q9zD4dKASbG8hy/LpzAVNzEQzw8sEIeloJsc4=
github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI=

View File

@ -122,7 +122,7 @@ func (this *Agent) Close() {
func (this *Agent) messageDistribution(msg *pb.Message) { func (this *Agent) messageDistribution(msg *pb.Message) {
reply := &pb.UserMessageReply{} reply := &pb.UserMessageReply{}
log.Debugf("agent:%s uId:%d MessageDistribution msg:%s", this.sessionId, this.uId, msg.Head.ServiceMethod) log.Debugf("agent:%s uId:%d MessageDistribution msg:%s", this.sessionId, this.uId, msg.Head.ServiceMethod)
if err := this.gateway.Service().RpcCallByType("worker", string(comm.Rpc_GateRoute), context.Background(), &pb.UserMessage{ if err := this.gateway.Service().RpcCallByType("worker", string(comm.Rpc_GatewayRoute), context.Background(), &pb.UserMessage{
Ip: this.IP(), Ip: this.IP(),
UserSessionId: this.sessionId, UserSessionId: this.sessionId,
UserId: this.uId, UserId: this.uId,

View File

@ -44,7 +44,7 @@ func (this *SComp_GateRouteComp) Init(service core.IService, comp core.IServiceC
} }
func (this *SComp_GateRouteComp) Start() (err error) { func (this *SComp_GateRouteComp) Start() (err error) {
this.service.RegisterFunctionName(string(comm.Rpc_GateRoute), this.ReceiveMsg) //注册网关路由接收接口 this.service.RegisterFunctionName(string(comm.Rpc_GatewayRoute), this.ReceiveMsg) //注册网关路由接收接口
err = this.ServiceCompBase.Start() err = this.ServiceCompBase.Start()
return return
} }