Documentation
¶
Index ¶
- Constants
- Variables
- func PrivateSendChatRoomNotify(message *logic.ChatRoomMessage, userGateways []*logic.UserGateway, ...) error
- func SendChatRoomBroadcast(message *logic.ChatRoomMessage, gatewayAddrs map[string]int, traceId string) error
- func SendChatRoomNotify(message *logic.ChatRoomMessage, gatewayAddrs map[string]int, traceId string) error
- func SendChatRoomNotifyBatch(msgs []*logic.ChatRoomMessageNotify, gwys map[string]int, isWeb bool) error
- func SendChatRoomNotifyWithDelay(message *logic.ChatRoomMessage, gatewayAddrs map[string]int, traceId string, ...) error
- func SendMsgNotify(gatewayAddr string, tags []string, connIds []logic.ConnectionId, ...) error
- func SendOnlineBroadcast(message *logic.ChatRoomMessage, gatewayAddrs map[string]int, traceId string) error
- func SendPushNotifyBatch(req []*ChatPushNotify) error
- func SendPushTags(tags, gatewayAddrs []string, sender, channel, traceSn string, msgId uint64) error
- func SendReConnectNotify(ip string, port uint32, moreIps []string, gateways []string, tags []string, ...) error
- type ChatPushNotify
- type ChatPushTags
- type ChatRoomNotifyBatchReq
- type GwPackage
- type GwResp
- type MsgNotify
- type ReConnectNotify
- type RouterStat
- func (stat *RouterStat) Add(add *RouterStat) *RouterStat
- func (stat *RouterStat) AtomicAddMltiInfos() uint64
- func (stat *RouterStat) AtomicCopyTo(copy *RouterStat) *RouterStat
- func (stat *RouterStat) AtomicGetMltiInfos() uint64
- func (stat *RouterStat) AtomicGetStatResponse() bool
- func (stat *RouterStat) AtomicMakeQps(i uint64) string
- func (stat *RouterStat) AtomicSetStatResponse(value bool)
- func (stat *RouterStat) QpsString() string
- func (stat *RouterStat) String() string
- func (stat *RouterStat) Sub(sub *RouterStat) *RouterStat
Constants ¶
const (
DisconnectAction = iota
)
Variables ¶
var GorpcClient *gorpc.Client
Functions ¶
func PrivateSendChatRoomNotify ¶
func PrivateSendChatRoomNotify(message *logic.ChatRoomMessage, userGateways []*logic.UserGateway, traceId string) error
func SendChatRoomBroadcast ¶
func SendChatRoomNotify ¶
func SendChatRoomNotifyBatch ¶
func SendMsgNotify ¶
func SendMsgNotify(gatewayAddr string, tags []string, connIds []logic.ConnectionId, messageNotify *logic.MessageNotify) error
func SendOnlineBroadcast ¶
func SendPushNotifyBatch ¶
func SendPushNotifyBatch(req []*ChatPushNotify) error
func SendPushTags ¶
func SendReConnectNotify ¶
func SendReConnectNotify(ip string, port uint32, moreIps []string, gateways []string, tags []string, userGateways []*logic.UserGateway) error
发送reconnect请求
Types ¶
type ChatPushNotify ¶
type ChatPushNotify struct { Appid int Receiver string GatewayAddr string ConnId logic.ConnectionId Sender string Channel string MsgId uint64 TraceSN string }
* Center uses this to send push request to router * * Appid: application, Huajiao is 2080 * Receiver: is push receiver * GateWays: is gateway information which receiver logged on, there might be more than one gateway * Sender: is who sends new message * Channel: indicates channel which new message is stored, so far only 'notify' * MsgId: new message id * TraceSN: trace sn
type ChatPushTags ¶
type ChatRoomNotifyBatchReq ¶
type ChatRoomNotifyBatchReq struct { Msgs []*logic.ChatRoomMessageNotify Gwys map[string]int IsWeb bool }
type GwPackage ¶
type GwPackage struct { XimpBuff *network.XimpBuffer // 前端传过来的包 Property map[string]string // 前端保存的一些连接信息 GatewayAddr string // gateway的gorpc ip和端口 ConnectionId logic.ConnectionId // 连接id }
gateway往后路由需要发送的数据结构
type GwResp ¶
type GwResp struct { XimpBuff *network.XimpBuffer // 需要发往客户端的包 Property map[string]string // 需要前端保存的一些连接信息 Priority bool // 是否是优先下发内容 Tags map[string]bool // 需要前端保存这个连接的tag信息,如果false表示删除 Actions []int // 需要执行的动作 Rkey []byte // 设置加密的key值 HeartBeatTimeout time.Duration Err string // 由于错误不能在gorpc里返回,所以只能在这里返回 }
发往gateway的数据结构
func RoutePackage ¶
func RoutePackage(buf *network.XimpBuffer, prop map[string]string, addr string, connectionId logic.ConnectionId) (*GwResp, error)
给gateway调用,将包路由到router
type MsgNotify ¶
type MsgNotify struct { GatewayAddr string Tags []string ConnIds []logic.ConnectionId MessageNotify *logic.MessageNotify }
发送消息到router 需要带的消息
type ReConnectNotify ¶
type RouterStat ¶
func GetRouterQps ¶
func GetRouterQps(gorpcAddr string) (*RouterStat, error)
* get router qps from specified saver * @param gorpcAddr is specified saver go rpc address * @return (*RouterStat, nil) if successful, otherwise (*RouterStat{}, error) will be return
func GetRouterTotalOps ¶
func GetRouterTotalOps(gorpcAddr string) (*RouterStat, error)
* get router total operations count after start from specified saver * @param gorpcAddr is specified saver go rpc address * @return (*RouterStat, nil) if successful, otherwise (*RouterStat{}, error) will be return
func (*RouterStat) Add ¶
func (stat *RouterStat) Add(add *RouterStat) *RouterStat
* stat add add and then store result in stat * @param add is value will be added * @return stat with new value
func (*RouterStat) AtomicAddMltiInfos ¶
func (stat *RouterStat) AtomicAddMltiInfos() uint64
atomic add functions
func (*RouterStat) AtomicCopyTo ¶
func (stat *RouterStat) AtomicCopyTo(copy *RouterStat) *RouterStat
operations
- this copy content of stat to 'copy' atomicly
- @param copy is target the content copy to
- @return copy if it is not nil, otherwise will return a new RouterStat point
func (*RouterStat) AtomicGetMltiInfos ¶
func (stat *RouterStat) AtomicGetMltiInfos() uint64
func (*RouterStat) AtomicGetStatResponse ¶
func (stat *RouterStat) AtomicGetStatResponse() bool
func (*RouterStat) AtomicMakeQps ¶
func (stat *RouterStat) AtomicMakeQps(i uint64) string
* this computes qps with stat according to interval * @param i is interval which unit is second * @return a json string that include saver QPS information
func (*RouterStat) AtomicSetStatResponse ¶
func (stat *RouterStat) AtomicSetStatResponse(value bool)
func (*RouterStat) QpsString ¶
func (stat *RouterStat) QpsString() string
func (*RouterStat) String ¶
func (stat *RouterStat) String() string
func (*RouterStat) Sub ¶
func (stat *RouterStat) Sub(sub *RouterStat) *RouterStat
* stat subtract sub and then store result in stat * @param sub is value will be subtracted * @return stat with new value