router

package
v0.0.0-...-cd87c42 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BackendAcceptor cellnet.Peer
View Source
var DebugMode bool

开启调试模式, 将显示完整的路由日志

View Source
var FrontendAcceptor cellnet.Peer

Functions

func BroadcastToClient

func BroadcastToClient(data interface{})

发送给所有router的所有客户端

func BroadcastToClientList

func BroadcastToClientList(data interface{}, list ClientList)

发送给指定客户端列表的客户端

func CloseAllClient

func CloseAllClient()

广播所有的客户端

func CloseClient

func CloseClient(routerSes cellnet.Session, clientid int64)

通知网关关闭客户端连接

func RegisterMessage

func RegisterMessage(msgName string, userHandler func(interface{}, cellnet.Session, int64))

注册连接消息

func RelayMessage

func RelayMessage(targetSvcName string, messageName string)

注册消息路由方法

func SendToClient

func SendToClient(routerSes cellnet.Session, clientid int64, data interface{})

将消息发送到客户端

func SetRelayMethod

func SetRelayMethod(method RelayMethod)

设置路由模式

func StartBackendAcceptor

func StartBackendAcceptor(pipe cellnet.EventPipe, address string, peerName string)

开启后台服务器的侦听通道

func StartBackendConnector

func StartBackendConnector(pipe cellnet.EventPipe, addressList []string, peerName string, svcName string)

后台服务器到router的连接

func StartFrontendAcceptor

func StartFrontendAcceptor(pipe cellnet.EventPipe, address string, peerName string)

开启前端侦听通道

Types

type ClientList

type ClientList map[cellnet.Session][]int64

客户端列表

func NewClientList

func NewClientList() ClientList

func (ClientList) Add

func (self ClientList) Add(routerSes cellnet.Session, clientid int64)

func (ClientList) Get

func (self ClientList) Get(ses cellnet.Session) []int64

type RelayMethod

type RelayMethod int
const (
	// 广播到后台所有服务器
	RelayMethod_BroardcastToAllBackend RelayMethod = iota

	// 按照白名单准确投递
	RelayMethod_WhiteList
)

Jump to

Keyboard shortcuts

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