mq

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventConnect = iota
	EventDisconnect
)

Variables

This section is empty.

Functions

func EncodePayloadToBin

func EncodePayloadToBin(netMsg *NetMsg) (bin []byte)

Types

type GateTcpMqEvent

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

type GateTcpMqInst

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

type MessageQueue

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

func NewMessageQueue

func NewMessageQueue(serverType spb.ServerType, appId uint32,
	discoveryClient *rpc.NodeDiscoveryClient, gateAddr, regionName string) (r *MessageQueue)

func (*MessageQueue) Close

func (m *MessageQueue) Close()

func (*MessageQueue) GetGateTcpMqInst

func (m *MessageQueue) GetGateTcpMqInst(serverType spb.ServerType, appId uint32) *GateTcpMqInst

func (*MessageQueue) GetNetMsg

func (m *MessageQueue) GetNetMsg() chan *NetMsg

func (*MessageQueue) SendToGame

func (m *MessageQueue) SendToGame(appid uint32, msg *NetMsg)

func (*MessageQueue) SendToGate

func (m *MessageQueue) SendToGate(appid uint32, msg *NetMsg)

type MsgType

type MsgType int
const (
	GameServer MsgType = 1 // 玩家消息转发
	ServerMsg  MsgType = 2 // 服务消息
	// 玩家事件
	PlayerLogin  MsgType = 3 // 玩家登录
	PlayerLogout MsgType = 4 // 玩家下线
)

type NetMsg

type NetMsg struct {
	// len 4
	ServerType        spb.ServerType // 目标 // 4
	AppId             uint32         // 目标 // 4
	OriginServerType  spb.ServerType // 源 // 4
	OriginServerAppId uint32         // 源 // 4
	MsgType           MsgType        // 消息类型 // 1
	Uid               uint32         // 玩家id // 4
	CmdId             uint16         // cmd id // 2
	ServiceMsgByte    []byte         // 消息
}

func DecodeBinToPayload

func DecodeBinToPayload(data []byte) *NetMsg

Jump to

Keyboard shortcuts

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