cherryAgent

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Init = iota
	WaitAck
	Working
	Closed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Options

	Session *cherrySession.Session // session
	// contains filtered or unexported fields
}

func NewAgent

func NewAgent(app cherryFacade.IApplication, opt Options, conn cherryFacade.INetConn) *Agent

func (*Agent) Close

func (a *Agent) Close()

Close closes the Agent, clean inner state and close low-level connection.

func (*Agent) Kick

func (a *Agent) Kick(reason interface{}) error

Kick kick session

func (*Agent) Push

func (a *Agent) Push(route string, val interface{}) error

Push implementation for session.NetworkEntity interface

func (*Agent) RPC

func (a *Agent) RPC(route string, val interface{}) error

RPC implementation for session.NetworkEntity interface

func (*Agent) RemoteAddr

func (a *Agent) RemoteAddr() net.Addr

RemoteAddr implementation for session.NetworkEntity interface returns the remote network address.

func (*Agent) Response

func (a *Agent) Response(mid uint, v interface{}, isError ...bool) error

Response implementation for session.NetworkEntity interface

func (*Agent) Run

func (a *Agent) Run()

func (*Agent) Send

func (a *Agent) Send(typ cherryMessage.Type, route string, mid uint, v interface{}, isError bool) (err error)

func (*Agent) SendRaw

func (a *Agent) SendRaw(bytes []byte) error

func (*Agent) SetLastAt

func (a *Agent) SetLastAt()

func (*Agent) SetStatus

func (a *Agent) SetStatus(state int32)

func (*Agent) Status

func (a *Agent) Status() int32

type AgentRemote

type AgentRemote struct {
	Session *cherrySession.Session
	// contains filtered or unexported fields
}

func (*AgentRemote) Close added in v1.1.1

func (a *AgentRemote) Close()

func (*AgentRemote) Kick added in v1.1.1

func (a *AgentRemote) Kick(reason interface{}) error

func (*AgentRemote) Push added in v1.1.1

func (a *AgentRemote) Push(route string, val interface{}) error

func (*AgentRemote) RPC added in v1.1.1

func (a *AgentRemote) RPC(route string, val interface{}) error

func (*AgentRemote) RemoteAddr added in v1.1.1

func (a *AgentRemote) RemoteAddr() net.Addr

func (*AgentRemote) Response added in v1.1.1

func (a *AgentRemote) Response(mid uint, val interface{}, isError ...bool) error

func (*AgentRemote) SendRaw added in v1.1.1

func (a *AgentRemote) SendRaw(bytes []byte) error

type Options

type Options struct {
	Heartbeat       time.Duration                        // heartbeat(sec)
	DataCompression bool                                 // data compression
	PacketListener  map[cherryPacket.Type]PacketListener // process packet listener function
	RPCHandler      RPCHandler                           // rpc handler
}

type PacketListener

type PacketListener func(agent *Agent, packet cherryFacade.IPacket)

PacketListener process packet listener function

type RPCHandler

type RPCHandler func(session *cherrySession.Session, msg *cherryMessage.Message)

Jump to

Keyboard shortcuts

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