推送权限测试
This commit is contained in:
parent
dea561817f
commit
7670cb6505
@ -14,7 +14,7 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
//序列化参数对象
|
||||
// LoadConfig 配置文件序列化为Options
|
||||
func (this *Options) LoadConfig(settings map[string]interface{}) (err error) {
|
||||
if settings != nil {
|
||||
err = mapstructure.Decode(settings, this)
|
||||
|
@ -16,19 +16,24 @@ type WSServiceComp struct {
|
||||
cbase.ModuleCompBase
|
||||
options *Options
|
||||
|
||||
module IGateway
|
||||
gin gin.ISys
|
||||
module IGateway // 网关
|
||||
gin gin.ISys // gin服务接口
|
||||
}
|
||||
|
||||
// Init websocket服务初始化
|
||||
func (this *WSServiceComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleCompBase.Init(service, module, comp, options)
|
||||
this.options = options.(*Options)
|
||||
this.module = module.(IGateway)
|
||||
this.gin, err = gin.NewSys(gin.SetListenPort(this.options.ListenPort))
|
||||
|
||||
// 游戏业务逻辑处理
|
||||
this.gin.GET("/gateway", this.ws)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ws 升级websocket连接处理本次请求
|
||||
func (this *WSServiceComp) ws(c *engine.Context) {
|
||||
upGrader := websocket.Upgrader{
|
||||
CheckOrigin: func(r *http.Request) bool {
|
||||
|
Loading…
Reference in New Issue
Block a user