dispatcher

package
v0.0.0-...-cccbfae Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

dispatcher包提供以注册+回调方式的消息处理方式, 封装消息解包, 打包的过程

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIDByName

func GetIDByName(name string) int

通过id取名字

func GetNameByID

func GetNameByID(id int) string

通过名字取id

func PeerHandler

func PeerHandler(disp *PacketDispatcher) func(cellnet.CellID, interface{})

处理Peer的新会话及会话的消息处理

func RegisterMessage

func RegisterMessage(disp *PacketDispatcher, msgIns interface{}, userHandler func(cellnet.CellID, interface{}))

将PB消息解析封装到闭包中

Types

type PacketDispatcher

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

func NewPacketDispatcher

func NewPacketDispatcher() *PacketDispatcher

func (*PacketDispatcher) Call

func (self *PacketDispatcher) Call(src cellnet.CellID, pkt *cellnet.Packet)

func (*PacketDispatcher) Exists

func (self *PacketDispatcher) Exists(id int) bool

func (*PacketDispatcher) RegisterCallback

func (self *PacketDispatcher) RegisterCallback(id int, f func(cellnet.CellID, *cellnet.Packet))

Jump to

Keyboard shortcuts

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