public static function GetConfig($userId, $cache = true, $reopen = false, $mobile = false) { $pullConfig = Array(); if (defined('BX_PULL_SKIP_LS')) $pullConfig['LOCAL_STORAGE'] = 'N'; if (IsModuleInstalled('bitrix24')) $pullConfig['BITRIX24'] = 'Y'; if (!CPullOptions::GetQueueServerHeaders()) $pullConfig['HEADERS'] = 'N'; $arChannel = CPullChannel::Get($userId, $cache, $reopen); if (is_array($arChannel)) { $nginxStatus = CPullOptions::GetQueueServerStatus(); $webSocketStatus = false; $arChannels = Array($arChannel['CHANNEL_ID']); if ($nginxStatus) { if (defined('BX_PULL_SKIP_WEBSOCKET')) { $pullConfig['WEBSOCKET'] = 'N'; } else { $webSocketStatus = CPullOptions::GetWebSocketStatus(); } $arChannelShared = CPullChannel::GetShared($cache, $reopen); if (is_array($arChannelShared)) { $arChannels[] = $arChannelShared['CHANNEL_ID']; $arChannel['CHANNEL_DT'] = $arChannel['CHANNEL_DT'].'/'.$arChannelShared['CHANNEL_DT']; } } if ($mobile || defined('BX_MOBILE') || defined('BX_PULL_MOBILE')) { $pullConfig['MOBILE'] = 'Y'; $pullPath = ($nginxStatus? (CMain::IsHTTPS()? CPullOptions::GetListenSecureUrl($arChannels, true): CPullOptions::GetListenUrl($arChannels, true)): '/bitrix/components/bitrix/pull.request/ajax.php?UPDATE_STATE'); $pullPathMod = ""; } else { $pullPath = ($nginxStatus? (CMain::IsHTTPS()? CPullOptions::GetListenSecureUrl($arChannels): CPullOptions::GetListenUrl($arChannels)): '/bitrix/components/bitrix/pull.request/ajax.php?UPDATE_STATE'); $pullPathMod = ($nginxStatus? (CMain::IsHTTPS()? CPullOptions::GetListenSecureUrl($arChannels, false, true): CPullOptions::GetListenUrl($arChannels, false, true)): ''); } $pullPathWs = ($nginxStatus && $webSocketStatus? (CMain::IsHTTPS()? CPullOptions::GetWebSocketSecureUrl($arChannels): CPullOptions::GetWebSocketUrl($arChannels)): ''); return $pullConfig+Array( 'CHANNEL_ID' => implode('/', $arChannels), 'CHANNEL_DT' => $arChannel['CHANNEL_DT'], 'LAST_ID' => $arChannel['LAST_ID'], 'PATH' => $pullPath, 'PATH_MOD' => $pullPathMod, 'PATH_WS' => $pullPathWs, 'PATH_COMMAND' => defined('BX_PULL_COMMAND_PATH')? BX_PULL_COMMAND_PATH: '', 'METHOD' => ($nginxStatus? 'LONG': 'PULL'), 'REVISION' => PULL_REVISION, 'ERROR' => '', ); } return false; }