msghandler

package
v0.0.0-...-0012533 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IMsgHandler

type IMsgHandler interface {
	//处理消息
	DoMsg()
	//处理Msg消息
	DoNormalMsg(name string, content interface{}) error
	//处理RPC消息
	DoRPCMsg(methodName string, content interface{}) error
	// FireMsg 触发消息, 保证不被挂起
	FireMsg(name string, content interface{})
	// FireRPC 触发消息, 保证不被挂起
	FireRPC(method string, content interface{})

	// RegMsgProc 注册消息处理对象
	// 其中 proc 是一个对象,包含是类似于 MsgProc_XXXXX的一系列函数,分别用来处理不同的消息
	RegMsgProc(proc interface{})
	//注册出错时的处理函数
	RegOnPanicFunc(f func(err error))

	//获取有消息时的chan
	GetCallChan() chan bool
	// SetMainHander 设置父级消息路由器
	SetMainHander(msghandler IMsgHandler)
	//调用出错处理函数
	OnPanicFunc(err error)
	// contains filtered or unexported methods
}

type MsgHandler

type MsgHandler struct {
	// contains filtered or unexported fields
}

MsgHandler 消息处理中心

func NewMsgHandler

func NewMsgHandler() *MsgHandler

NewMsgHandler 创建一个新的消息处理器

func (*MsgHandler) DoMsg

func (handlers *MsgHandler) DoMsg()

DoMsg 将缓冲的消息一次性处理

func (*MsgHandler) DoNormalMsg

func (handlers *MsgHandler) DoNormalMsg(name string, content interface{}) error

DoNormalMsg 立即触发消息

func (*MsgHandler) DoRPCMsg

func (handlers *MsgHandler) DoRPCMsg(methodName string, content interface{}) error

DoRPCMsg RPC执行

func (*MsgHandler) FireMsg

func (handlers *MsgHandler) FireMsg(name string, content interface{})

FireMsg 触发消息, 保证不被挂起

func (*MsgHandler) FireRPC

func (handlers *MsgHandler) FireRPC(method string, content interface{})

FireRPC 触发消息, 保证不被挂起

func (*MsgHandler) GetCallChan

func (handlers *MsgHandler) GetCallChan() chan bool

获取有消息的信号量

func (*MsgHandler) GetNewSubHandler

func (this *MsgHandler) GetNewSubHandler() (result *MsgHandler)

获取子处理器

func (*MsgHandler) OnPanicFunc

func (handlers *MsgHandler) OnPanicFunc(err error)

func (*MsgHandler) RegMsgProc

func (handlers *MsgHandler) RegMsgProc(proc interface{})

RegMsgProc 注册消息处理对象 其中 proc 是一个对象,包含是类似于 MsgProc_XXXXX的一系列函数,分别用来处理不同的消息

func (*MsgHandler) RegOnPanicFunc

func (handlers *MsgHandler) RegOnPanicFunc(f func(err error))

func (*MsgHandler) SetMainHander

func (handlers *MsgHandler) SetMainHander(msghandler IMsgHandler)

SetMainHander 设置父级消息路由器

Jump to

Keyboard shortcuts

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