コード例 #1
0
ファイル: driver.php プロジェクト: DarneoStudio/bitrix
 /**
  * Send event by module pull.
  *
  * @param int|array $userIds List of user ids.
  * @param string $command Command determine action on client.
  * @param array     $data Optional data which can be used on client.
  * @throws \Bitrix\Main\LoaderException
  * @return void
  */
 public function sendEvent($userIds, $command, array $data = array())
 {
     if (empty($userIds)) {
         return;
     }
     if (!Loader::includeModule('pull')) {
         return;
     }
     $message = array('module_id' => self::INTERNAL_MODULE_ID, 'command' => $command, 'params' => $data);
     if (!is_array($userIds)) {
         $userIds = array($userIds);
     }
     foreach (array_unique($userIds) as $userId) {
         \CPullStack::addByUser($userId, $message);
     }
     unset($userId);
 }