* @copyright walkor * @link http://www.workerman.net/ * @license http://www.opensource.org/licenses/mit-license.php MIT License */ use \Workerman\Worker; use \GatewayWorker\Gateway; // 自动加载类 require_once __DIR__ . '/../../vendor/autoload.php'; if (Config['gateway']['is_run']) { // gateway 进程,这里使用Text协议,可以用telnet测试 $gateway = new Gateway("tcp://0.0.0.0:" . Config['gateway']['port']); // gateway名称,status方便查看 $gateway->name = Config['name'] . 'Gateway'; // gateway进程数 $gateway->count = Config['gateway']['count']; // 本机ip,分布式部署时使用内网ip $gateway->lanIp = Config['gateway_lanIp']; // 内部通讯起始端口,假如$gateway->count=4,起始端口为4000 // 则一般会使用4000 4001 4002 4003 4个端口作为内部通讯端口 $gateway->startPort = Config['gateway']['startPort']; // 服务注册地址 $gateway->registerAddress = Config['registerAddress']; // 心跳间隔 $gateway->pingInterval = Config['gateway']['pingInterval']; $gateway->pingNotResponseLimit = Config['gateway']['pingNotResponseLimit']; // 心跳数据 $gateway->pingData = ''; // 如果不是在根目录启动,则运行runAll方法 if (!defined('GLOBAL_START')) { Worker::runAll(); } }