Exemple #1
0
// 预投递publish类型的消息,如果是特殊频道特殊处理,否则正常处理
func (this *service) preDispatchPublish(msg *message.PublishMessage) (err error) {
	switch string(msg.Topic()) {
	case BroadCastChannel:
		go OnGroupPublish(msg, this)
	case SendChannel:
		go this.onReceiveBadge(msg)
	case ApnPushChannel:
		go onAPNsPush(msg, this)
	case ApnInvalidTokensChannel:
		go getInvalidApnTokens(this)
	case OnlineStatusChannel:
		go this.checkOnlineStatus(msg)
	default:
		msg.SetPacketId(getNextPktId())
		Log.Infoc(func() string {
			return fmt.Sprintf("(%s) process private message.pkt_id: %d, payload size: %d", this.cid(), msg.PacketId(), len(msg.Payload()))
		})
		go this.postPublish(msg)
	}
	return
}