46 lines
876 B
Go
46 lines
876 B
Go
package comm
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"github.com/liwei1dao/lego/core"
|
|
)
|
|
|
|
const (
|
|
SC_ServiceGateRouteComp core.S_Comps = "SC_GateRouteComp" //s_comps.ISC_GateRouteComp
|
|
)
|
|
|
|
const (
|
|
SM_GateModule core.M_Modules = "SM_GateModule" //gate模块 网关服务模块
|
|
SM_WebModule core.M_Modules = "SM_WebModule" //web模块
|
|
)
|
|
|
|
const ( //Rpc
|
|
Rpc_GateRoute core.Rpc_Key = "Rpc_GateRoute" //网关路由
|
|
)
|
|
|
|
type ISC_GateRouteComp interface {
|
|
core.IServiceComp
|
|
RegisterRoute(methodName string, msg reflect.Type, fn reflect.Method)
|
|
}
|
|
|
|
//用户会话
|
|
type IUserSession interface {
|
|
GetSessionId() string
|
|
GetIP() string
|
|
GetGatewayServiceId() string
|
|
SendMsg(ServiceMethod string, msg interface{}) (err error)
|
|
Close() (err error)
|
|
}
|
|
|
|
//消息体
|
|
type MessageHead struct {
|
|
ServiceMethod string //服务名
|
|
}
|
|
|
|
//处理JSON消息
|
|
type Message struct {
|
|
Head *MessageHead
|
|
Data []byte
|
|
}
|