grpc

package
v0.0.0-...-5b4c1f5 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Login

func Login(s *Module, uid string, pwd string) (string, server.Ret)

Login user to login

func LoginResponse

func LoginResponse(agent network.IAgentAdapter, m transport.IMessage) error

LoginResponse request login

func ModuleCreate

func ModuleCreate() (server.Module, error)

ModuleCreate module create function

func NewAgentAdapter

func NewAgentAdapter(conn network.IConn) network.IAgentAdapter

NewAgentAdapter create agent adapter

Types

type AgentAdapter

type AgentAdapter struct {
	network.AgentAdapter
}

AgentAdapter do agent hander

func (*AgentAdapter) OnClose

func (a *AgentAdapter) OnClose()

OnClose agent close and clear

func (*AgentAdapter) ProcessMessage

func (a *AgentAdapter) ProcessMessage(payload interface{}) error

ProcessMessage process request and notify message

type Module

type Module struct {
	server.BaseContext

	Clients *skiplist.SkipList
	// contains filtered or unexported fields
}

Module struct to define module

func (*Module) GetAgent

func (s *Module) GetAgent(option uint32) network.IAgent

GetAgent get agent by option

func (*Module) Handlers

func (s *Module) Handlers() map[string]interface{}

Handlers set moudle handlers

func (*Module) OnRun

func (s *Module) OnRun(dt time.Duration)

OnRun goruntine run and call OnRun , always use ModuleRun to call this function

func (*Module) PushBytes

func (s *Module) PushBytes(option int32, buf []byte) error

PushBytes async send string or bytes to queue

func (*Module) ReadConfig

func (s *Module) ReadConfig(conf server.IConfig) error

ReadConfig config map address default :80

func (*Module) ReflectHandlers

func (s *Module) ReflectHandlers() map[string]interface{}

ReflectHandlers set moudle reflect handlers

func (*Module) Reload

func (s *Module) Reload(conf server.IConfig) error

Reload reload config

func (*Module) Setup

func (s *Module) Setup(conf server.IConfig) (server.Module, error)

Setup init custom module and pass config map to module config

m := map[string]interface{}{
 "queueSize":1000,
}

func (*Module) Stop

func (s *Module) Stop() error

Stop goruntine

func (*Module) UserData

func (s *Module) UserData() int32

UserData module custom option, can you store you data and you must keep goruntine safe

Jump to

Keyboard shortcuts

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