Documentation ¶
Overview ¶
Package basegate handler
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 basegate gate.Session
Index ¶
- Variables
- func NewGateHandler(gate gate.Gate) *handler
- func NewMqttAgent(module module.RPCModule) *agent
- func NewSession(app module.App, data []byte) (gate.Session, error)
- func NewSessionByMap(app module.App, data map[string]interface{}) (gate.Session, error)
- type Gate
- func (gt *Gate) Deserialize(ptype string, b []byte) (param interface{}, err error)
- func (gt *Gate) GetAgentLearner() gate.AgentLearner
- func (gt *Gate) GetGateHandler() gate.GateHandler
- func (gt *Gate) GetJudgeGuest() func(session gate.Session) bool
- func (gt *Gate) GetModule() module.RPCModule
- func (gt *Gate) GetRouteHandler() gate.RouteHandler
- func (gt *Gate) GetSessionLearner() gate.SessionLearner
- func (gt *Gate) GetStorageHandler() (storage gate.StorageHandler)
- func (gt *Gate) GetTypes() []string
- func (gt *Gate) NewSession(data []byte) (gate.Session, error)
- func (gt *Gate) NewSessionByMap(data map[string]interface{}) (gate.Session, error)
- func (gt *Gate) OnAppConfigurationLoaded(app module.App)
- func (gt *Gate) OnConfChanged(settings *conf.ModuleSettings)
- func (gt *Gate) OnDestroy()
- func (gt *Gate) OnInit(subclass module.RPCModule, app module.App, settings *conf.ModuleSettings, ...)
- func (gt *Gate) Options() gate.Options
- func (gt *Gate) Run(closeSig chan bool)
- func (gt *Gate) Serialize(param interface{}) (ptype string, p []byte, err error)
- func (gt *Gate) SetCreateAgent(cfunc func() gate.Agent) error
- func (gt *Gate) SetJudgeGuest(judgeGuest func(session gate.Session) bool) error
- func (gt *Gate) SetRouteHandler(router gate.RouteHandler) error
- func (gt *Gate) SetSessionLearner(sessionLearner gate.SessionLearner) error
- func (gt *Gate) SetStorageHandler(storage gate.StorageHandler) error
- type SessionImp
- func (*SessionImp) Descriptor() ([]byte, []int)deprecated
- func (x *SessionImp) GetCarrier() map[string]string
- func (x *SessionImp) GetIP() string
- func (x *SessionImp) GetNetwork() string
- func (x *SessionImp) GetServerId() string
- func (x *SessionImp) GetSessionId() string
- func (x *SessionImp) GetSettings() map[string]string
- func (x *SessionImp) GetSpanId() string
- func (x *SessionImp) GetTopic() string
- func (x *SessionImp) GetTraceId() string
- func (x *SessionImp) GetUserId() string
- func (*SessionImp) ProtoMessage()
- func (x *SessionImp) ProtoReflect() protoreflect.Message
- func (x *SessionImp) Reset()
- func (x *SessionImp) String() string
- type SessionSerialize
Constants ¶
This section is empty.
Variables ¶
var File_session_proto protoreflect.FileDescriptor
var RPCParamProtocolMarshalType = gate.RPCParamProtocolMarshalType
var RPCParamSessionType = gate.RPCParamSessionType
Functions ¶
func NewMqttAgent ¶
func NewSession ¶
NewSession NewSession
Types ¶
type Gate ¶
type Gate struct { //module.RPCSerialize basemodule.BaseModule // contains filtered or unexported fields }
func (*Gate) Deserialize ¶
func (*Gate) GetAgentLearner ¶
func (gt *Gate) GetAgentLearner() gate.AgentLearner
func (*Gate) GetGateHandler ¶
func (gt *Gate) GetGateHandler() gate.GateHandler
func (*Gate) GetRouteHandler ¶
func (gt *Gate) GetRouteHandler() gate.RouteHandler
func (*Gate) GetSessionLearner ¶
func (gt *Gate) GetSessionLearner() gate.SessionLearner
func (*Gate) GetStorageHandler ¶
func (gt *Gate) GetStorageHandler() (storage gate.StorageHandler)
func (*Gate) NewSessionByMap ¶
func (*Gate) OnAppConfigurationLoaded ¶
func (*Gate) OnConfChanged ¶
func (gt *Gate) OnConfChanged(settings *conf.ModuleSettings)
func (*Gate) SetCreateAgent ¶
* 设置创建客户端Agent的函数
func (*Gate) SetJudgeGuest ¶
func (*Gate) SetRouteHandler ¶
func (gt *Gate) SetRouteHandler(router gate.RouteHandler) error
* 设置Session信息持久化接口
func (*Gate) SetSessionLearner ¶
func (gt *Gate) SetSessionLearner(sessionLearner gate.SessionLearner) error
* 设置客户端连接和断开的监听器
func (*Gate) SetStorageHandler ¶
func (gt *Gate) SetStorageHandler(storage gate.StorageHandler) error
* 设置Session信息持久化接口
type SessionImp ¶
type SessionImp struct { IP string `protobuf:"bytes,1,opt,name=IP,proto3" json:"IP,omitempty"` Network string `protobuf:"bytes,2,opt,name=Network,proto3" json:"Network,omitempty"` UserId string `protobuf:"bytes,3,opt,name=UserId,proto3" json:"UserId,omitempty"` SessionId string `protobuf:"bytes,4,opt,name=SessionId,proto3" json:"SessionId,omitempty"` ServerId string `protobuf:"bytes,5,opt,name=ServerId,proto3" json:"ServerId,omitempty"` TraceId string `protobuf:"bytes,6,opt,name=TraceId,proto3" json:"TraceId,omitempty"` SpanId string `protobuf:"bytes,7,opt,name=SpanId,proto3" json:"SpanId,omitempty"` Settings map[string]string `` /* 157-byte string literal not displayed */ Carrier map[string]string `` /* 155-byte string literal not displayed */ Topic string `protobuf:"bytes,10,opt,name=Topic,proto3" json:"Topic,omitempty"` // contains filtered or unexported fields }
func (*SessionImp) Descriptor
deprecated
func (*SessionImp) Descriptor() ([]byte, []int)
Deprecated: Use SessionImp.ProtoReflect.Descriptor instead.
func (*SessionImp) GetCarrier ¶
func (x *SessionImp) GetCarrier() map[string]string
func (*SessionImp) GetIP ¶
func (x *SessionImp) GetIP() string
func (*SessionImp) GetNetwork ¶
func (x *SessionImp) GetNetwork() string
func (*SessionImp) GetServerId ¶
func (x *SessionImp) GetServerId() string
func (*SessionImp) GetSessionId ¶
func (x *SessionImp) GetSessionId() string
func (*SessionImp) GetSettings ¶
func (x *SessionImp) GetSettings() map[string]string
func (*SessionImp) GetSpanId ¶
func (x *SessionImp) GetSpanId() string
func (*SessionImp) GetTopic ¶
func (x *SessionImp) GetTopic() string
func (*SessionImp) GetTraceId ¶
func (x *SessionImp) GetTraceId() string
func (*SessionImp) GetUserId ¶
func (x *SessionImp) GetUserId() string
func (*SessionImp) ProtoMessage ¶
func (*SessionImp) ProtoMessage()
func (*SessionImp) ProtoReflect ¶ added in v1.4.11
func (x *SessionImp) ProtoReflect() protoreflect.Message
func (*SessionImp) Reset ¶
func (x *SessionImp) Reset()
func (*SessionImp) String ¶
func (x *SessionImp) String() string
type SessionSerialize ¶ added in v1.5.2
func (*SessionSerialize) Deserialize ¶ added in v1.5.2
func (gt *SessionSerialize) Deserialize(ptype string, b []byte) (param interface{}, err error)
func (*SessionSerialize) GetTypes ¶ added in v1.5.2
func (gt *SessionSerialize) GetTypes() []string