basegate

package
v1.6.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2018 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Copyright 2014 mqant 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.

Copyright 2014 mqant 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.

Copyright 2014 mqant 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.

Copyright 2014 mqant 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.

Package gate is a generated protocol buffer package.

It is generated from these files:

session/session.proto

It has these top-level messages:

Session

Index

Constants

This section is empty.

Variables

View Source
var RPC_PARAM_ProtocolMarshal_TYPE = "ProtocolMarshal"
View Source
var RPC_PARAM_SESSION_TYPE = "SESSION"

Functions

func Get_uuid

func Get_uuid() string

func NewGateHandler

func NewGateHandler(gate gate.Gate) *handler

func NewMqttAgent

func NewMqttAgent(module module.RPCModule) *agent

func NewSession

func NewSession(app module.App, data []byte) (gate.Session, error)

func NewSessionByMap

func NewSessionByMap(app module.App, data map[string]interface{}) (gate.Session, error)

func RandInt64

func RandInt64(min, max int64) int64

函 数:生成随机数 概 要: 参 数:

min: 最小值
max: 最大值

返回值:

int64: 生成的随机数

func TimeNow

func TimeNow() time.Time

func TransNumToString

func TransNumToString(num int64) (string, error)

func TransStringToNum

func TransStringToNum(str string) (int64, error)

Types

type Gate

type Gate struct {
	//module.RPCSerialize
	basemodule.BaseModule
	MaxConnNum          int
	MaxMsgLen           uint32
	MinStorageHeartbeat int64 //Session持久化最短心跳包

	// websocket
	WSAddr      string
	HTTPTimeout time.Duration

	// tcp
	TCPAddr string

	//tls
	Tls      bool
	CertFile string
	KeyFile  string
	// contains filtered or unexported fields
}

func (*Gate) Deserialize

func (this *Gate) Deserialize(ptype string, b []byte) (param interface{}, err error)

func (*Gate) GetAgentLearner

func (this *Gate) GetAgentLearner() gate.AgentLearner

func (*Gate) GetGateHandler

func (this *Gate) GetGateHandler() gate.GateHandler

func (*Gate) GetMinStorageHeartbeat

func (this *Gate) GetMinStorageHeartbeat() int64

func (*Gate) GetModule

func (this *Gate) GetModule() module.RPCModule

func (*Gate) GetSessionLearner

func (this *Gate) GetSessionLearner() gate.SessionLearner

func (*Gate) GetStorageHandler

func (this *Gate) GetStorageHandler() (storage gate.StorageHandler)

func (*Gate) GetTracingHandler

func (this *Gate) GetTracingHandler() gate.TracingHandler

func (*Gate) GetTypes

func (this *Gate) GetTypes() []string

func (*Gate) NewSession

func (this *Gate) NewSession(data []byte) (gate.Session, error)

func (*Gate) NewSessionByMap

func (this *Gate) NewSessionByMap(data map[string]interface{}) (gate.Session, error)

func (*Gate) OnAppConfigurationLoaded

func (this *Gate) OnAppConfigurationLoaded(app module.App)

func (*Gate) OnConfChanged

func (this *Gate) OnConfChanged(settings *conf.ModuleSettings)

func (*Gate) OnDestroy

func (this *Gate) OnDestroy()

func (*Gate) OnInit

func (this *Gate) OnInit(subclass module.RPCModule, app module.App, settings *conf.ModuleSettings)

func (*Gate) Run

func (this *Gate) Run(closeSig chan bool)

func (*Gate) Serialize

func (this *Gate) Serialize(param interface{}) (ptype string, p []byte, err error)

* 自定义rpc参数序列化反序列化 Session

func (*Gate) SetCreateAgent

func (this *Gate) SetCreateAgent(cfunc func() gate.Agent) error

* 设置创建客户端Agent的函数

func (*Gate) SetSessionLearner

func (this *Gate) SetSessionLearner(sessionLearner gate.SessionLearner) error

* 设置客户端连接和断开的监听器

func (*Gate) SetStorageHandler

func (this *Gate) SetStorageHandler(storage gate.StorageHandler) error

* 设置Session信息持久化接口

func (*Gate) SetTracingHandler

func (this *Gate) SetTracingHandler(tracing gate.TracingHandler) error

* 设置Session信息持久化接口

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL