Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
config.php
1<?php
2
4
6
7class Config
8{
9 const DEFAULT_SERVER = "https://rtc-cloud.bitrix.info";
10 const HOSTNAME_URL = "/hostname";
11 const SERVER_LIST_URL = "/servers";
12 const REGISTER_URL = "/register-client/";
13 const PUB_URL = "/pub/";
14 const SUB_URL = "/subws/";
15 const REST_URL = "/rest/";
16 const RPC_URL = "/api/";
17
18 const SERVER_ADDRESS = 'shared_server_address';
19 const SHARED_SERVER_KEY = 'shared_server_key';
20 const IS_REGISTERED_ON_SHARED_SERVER = 'registered_on_shared_server';
22
23 public static function getServerVersion()
24 {
25 return static::CLOUD_SERVER_VERSION;
26 }
27
28 public static function getDefaultCloudServer(): string
29 {
30 return defined('PULL_CLOUD_SERVER') ? PULL_CLOUD_SERVER : static::DEFAULT_SERVER;
31 }
32
33 public static function getServerAddress()
34 {
35 return Option::get("pull", static::SERVER_ADDRESS);
36 }
37
38 public static function setServerAddress($serverAddress)
39 {
40 Option::set("pull", static::SERVER_ADDRESS, $serverAddress);
41 }
42
43 public static function getRegisterUrl()
44 {
45 return "https://" . static::getServerAddress() . (defined("PULL_SHARED_REGISTER_URL") ? PULL_SHARED_REGISTER_URL : static::REGISTER_URL);
46 }
47
53 public static function getPublishUrl()
54 {
55 return "https://" . static::getServerAddress() . static::PUB_URL;
56 }
57
63 public static function getJsonRpcUrl()
64 {
65 return "https://" . static::getServerAddress() . static::RPC_URL;
66 }
67
73 public static function getLongPollingUrl()
74 {
75 return "https://" . static::getServerAddress() . static::SUB_URL;
76 }
77
83 public static function getWebSocketUrl()
84 {
85 $result = "wss://" . static::getServerAddress() . static::SUB_URL;
86 return $result;
87 }
88
92 public static function getWebPublishUrl()
93 {
94 return "https://" . static::getServerAddress() . static::REST_URL;
95 }
96
97 public static function setSignatureKey($signatureKey)
98 {
99 Option::set("pull", static::SHARED_SERVER_KEY, $signatureKey);
100 }
101
102 public static function getSignatureKey()
103 {
104 return Option::get("pull", static::SHARED_SERVER_KEY);
105 }
106
107 public static function setRegistered($isRegistered)
108 {
109 Option::set("pull", static::IS_REGISTERED_ON_SHARED_SERVER, ($isRegistered ? "Y" : "N"));
110 }
111
112 public static function isRegistered()
113 {
114 return (Option::get("pull", static::IS_REGISTERED_ON_SHARED_SERVER) === "Y");
115 }
116}
static setSignatureKey($signatureKey)
Definition config.php:97
static setServerAddress($serverAddress)
Definition config.php:38
static setRegistered($isRegistered)
Definition config.php:107