func (this *UnregisterComponent) offlineBroadcast(buffPool *buffpool.BuffPool, userUuid string, devID uint32) error {

	if GetRunWithSnode().Flag {
		snode_component.GetNodeComponent().Logout(userID, devID)
		snode_component.GetNodeComponent().DecUsersNumber()
		snode_component.GetNodeComponent().DecConnNumber()
	}

	if buffPool == nil {
		err := errors.New("UnRegisterComponent offlineBroadcast Error: invalid argument")
		return err
	}

	var dispatcherOut *DispatcherOutComponent
	for {
		dispatcherOut = GetDispatcherOutComponent()
		if dispatcherOut != nil {
			break
		} else {
			fmt.Println("UnregisterComponent.offlineBroadcast() Error:can not get a dispatcher, will try again")
		}
	}

	brMsg := protocol.BRMsg{
		UserUuid: userUuid,
		DeviceId: devID,
	}

	brData, err := brMsg.Encode()
	if err != nil {
		err := errors.New("UnregisterComponent.offlienBroadcast() Error: " + err.Error())
		return err
	}

	servNoUuidArr := buffPool.GetAllServices()
	for num, uuidArr := range servNoUuidArr {
		for _, uuid := range uuidArr {
			offlineMsg, err := protocol.NewMessage(protocol.VERSION, protocol.MT_BROADCAST_OFFLINE, protocol.PT_PUSHSERVER, 0, num, uint16(len(brData)),
				P_UID, uuid, 0, brData)
			if err != nil {
				err = errors.New("UnregisterComponent offlineBroadcast() Error: " + err.Error())
				return err
			}
			dispatcherOut.NPushBack(offlineMsg, false) //not need forward
		}
	}

	return nil
}
func (this *RegisterComponent) onlineBroadcast(buffPool *buffpool.BuffPool, dispatcherOut *DispatcherOutComponent, userUuid string, deviceID uint32) error {

	if GetRunWithSnode().Flag {
		onlineInfo := structure.ClientOnlineInfo{
			PushID:   this.PushID,
			ParentID: this.PushID,
		}
		data, err := onlineInfo.Encode()
		if err != nil {
			err = errors.New("RegisterComponent onlineBroadcast() Error: " + err.Error())
			return err
		}
		snode_component.GetNodeComponent().Forward(define.ONLINE, userUuid, deviceID, data)
		snode_component.GetNodeComponent().AddUsersNumber()
		snode_component.GetNodeComponent().AddConnNumber()
	}

	if buffPool == nil || dispatcherOut == nil {
		err := errors.New("RegisterComponent onlineBroadcast() Error: invalid argument")
		return err
	}

	brMsg := protocol.BRMsg{
		userUuid,
		deviceID,
	}
	brData, err := brMsg.Encode()
	if err != nil {
		err := errors.New("RegisterCompoent onlineBroadcast() Error: " + err.Error())
		return err
	}

	servNoUuidArr := buffPool.GetAllServices()
	for num, uuidArr := range servNoUuidArr {
		for _, uuid := range uuidArr {
			onlineMsg, err := protocol.NewMessage(protocol.VERSION, protocol.MT_BROADCAST_ONLINE, protocol.PT_PUSHSERVER, 0, num, uint16(len(brData)),
				P_UID, uuid, 0, brData)
			if err != nil {
				err = errors.New("RegisterComponent onlineBroadcast() Error: " + err.Error())
				return err
			}
			dispatcherOut.NPushBack(onlineMsg, false) //not need forward
		}
	}
	return nil
}