Versions in this module Expand all Collapse all v1 v1.2.1 Mar 15, 2020 Changes in this version + var RPC_PARAM_ProtocolMarshal_TYPE = "ProtocolMarshal" + var RPC_PARAM_SESSION_TYPE = "SESSION" + type Agent interface + Close func() + ConnTime func() time.Time + Destroy func() + GetSession func() Session + IsClosed func() bool + OnClose func() error + OnInit func(gate Gate, conn network.Conn) error + RevNum func() int64 + Run func() (err error) + SendNum func() int64 + WriteMsg func(topic string, body []byte) error + type AgentLearner interface + Connect func(a Agent) + DisConnect func(a Agent) + type Gate interface + GetAgentLearner func() AgentLearner + GetGateHandler func() GateHandler + GetJudgeGuest func() func(session Session) bool + GetRouteHandler func() RouteHandler + GetSessionLearner func() SessionLearner + GetStorageHandler func() StorageHandler + NewSession func(data []byte) (Session, error) + NewSessionByMap func(data map[string]interface{}) (Session, error) + Options func() Options + type GateHandler interface + Bind func(span log.TraceSpan, Sessionid string, Userid string) (result Session, err string) + BroadCast func(span log.TraceSpan, topic string, body []byte) (int64, string) + Close func(span log.TraceSpan, Sessionid string) (result interface{}, err string) + GetAgent func(Sessionid string) (Agent, error) + GetAgentNum func() int + IsConnect func(span log.TraceSpan, Sessionid string, Userid string) (result bool, err string) + OnDestroy func() + Push func(span log.TraceSpan, Sessionid string, Settings map[string]string) (result Session, err string) + Remove func(span log.TraceSpan, Sessionid string, key string) (result interface{}, err string) + Send func(span log.TraceSpan, Sessionid string, topic string, body []byte) (result interface{}, err string) + SendBatch func(span log.TraceSpan, Sessionids string, topic string, body []byte) (int64, string) + Set func(span log.TraceSpan, Sessionid string, key string, value string) (result Session, err string) + UnBind func(span log.TraceSpan, Sessionid string) (result Session, err string) + Update func(span log.TraceSpan, Sessionid string) (result Session, err string) + type Option func(*Options) + func BufSize(s int) Option + func ConcurrentTasks(s int) Option + func Heartbeat(s time.Duration) Option + func MaxPackSize(s int) Option + func OverTime(s time.Duration) Option + func SetAgentLearner(s AgentLearner) Option + func SetGateHandler(s GateHandler) Option + func SetRouteHandler(s RouteHandler) Option + func SetSendMessageHook(s SendMessageHook) Option + func SetSessionLearner(s SessionLearner) Option + func SetStorageHandler(s StorageHandler) Option + type Options struct + AgentLearner AgentLearner + BufSize int + ConcurrentTasks int + GateHandler GateHandler + Heartbeat time.Duration + MaxPackSize int + OverTime time.Duration + RouteHandler RouteHandler + SendMessageHook SendMessageHook + SessionLearner SessionLearner + StorageHandler StorageHandler + func NewOptions(opts ...Option) Options + type RouteHandler interface + OnRoute func(session Session, topic string, msg []byte) (bool, interface{}, error) + type SendMessageHook func(session Session, topic string, msg []byte) ([]byte, error) + type Session interface + Bind func(UserId string) (err string) + Clone func() Session + Close func() (err string) + CreateTrace func() + ExtractSpan func() log.TraceSpan + Get func(key string) (result string) + GetIP func() string + GetNetwork func() string + GetServerId func() string + GetSessionId func() string + GetSettings func() map[string]string + GetTopic func() string + GetUserId func() string + GetUserIdInt64 func() int64 + IsConnect func(Userid string) (result bool, err string) + IsGuest func() bool + JudgeGuest func(judgeGuest func(session Session) bool) + LocalUserData func() interface{} + Push func() (err string) + Remove func(key string) (err string) + RemoveLocalKV func(key string) error + Send func(topic string, body []byte) (err string) + SendBatch func(Sessionids string, topic string, body []byte) (int64, string) + SendNR func(topic string, body []byte) (err string) + Serializable func() ([]byte, error) + Set func(key string, value string) (err string) + SetBatch func(settings map[string]string) (err string) + SetIP func(ip string) + SetLocalKV func(key, value string) error + SetLocalUserData func(data interface{}) error + SetNetwork func(network string) + SetPush func(key string, value string) (err string) + SetServerId func(serverid string) + SetSessionId func(sessionid string) + SetSettings func(settings map[string]string) + SetTopic func(topic string) + SetUserId func(userid string) + SpanId func() string + TraceId func() string + UnBind func() (err string) + Update func() (err string) + type SessionLearner interface + Connect func(a Session) + DisConnect func(a Session) + type StorageHandler interface + Delete func(session Session) (err error) + Heartbeat func(session Session) + Query func(Userid string) (data []byte, err error) + Storage func(session Session) (err error)