fixed
This commit is contained in:
parent
00f49b08f0
commit
0eb6d8607d
@ -17,7 +17,7 @@ class ImController extends BaseLikeAdminController
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
Gateway::$registerAddress = "172.19.97.179:1256";
|
||||
Gateway::$registerAddress = env('worker.address').':'.env('worker.port');
|
||||
}
|
||||
|
||||
//获取场景值
|
||||
|
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
namespace workerim;
|
||||
namespace app\common\service\workerim;
|
||||
|
||||
use GatewayClient\Gateway;
|
||||
|
||||
/**
|
||||
* 主逻辑
|
||||
* 主要是处理 onConnect onMessage onClose 三个方法
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use \Workerman\Worker;
|
||||
use \GatewayWorker\BusinessWorker;
|
||||
<?php
|
||||
|
||||
use GatewayWorker\BusinessWorker;
|
||||
use Workerman\Worker;
|
||||
|
||||
|
||||
// 自动加载类
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../../../../vendor/autoload.php';
|
||||
|
||||
// bussinessWorker 进程
|
||||
$worker = new BusinessWorker();
|
||||
@ -17,10 +17,10 @@ $worker->name = 'PushBusinessWorker';
|
||||
$worker->count = 4;
|
||||
|
||||
// 服务注册地址
|
||||
$worker->registerAddress = '172.19.97.179:1256';
|
||||
$worker->registerAddress = env('worker.address').':'.env('worker.port');
|
||||
|
||||
// 注册服务类
|
||||
$worker->eventHandler = 'workerim\Events';
|
||||
$worker->eventHandler = 'app\common\service\workerim\Events';
|
||||
|
||||
// 如果不是在根目录启动,则运行runAll方法
|
||||
if(!defined('GLOBAL_START'))
|
@ -4,26 +4,26 @@ use \Workerman\Worker;
|
||||
use \GatewayWorker\Gateway;
|
||||
|
||||
// 自动加载类
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../../../../vendor/autoload.php';
|
||||
|
||||
// gateway 进程,这里使用Text协议,可以用telnet测试
|
||||
$gateway = new Gateway("Websocket://0.0.0.0:8282");
|
||||
|
||||
// gateway名称,status方便查看
|
||||
$gateway->name = 'worker_task_im';
|
||||
$gateway->name = env('worker.work_name');
|
||||
|
||||
// gateway进程数,一般设置2个就足够
|
||||
$gateway->count = 4;
|
||||
|
||||
// 本机ip,分布式部署时使用内网ip
|
||||
$gateway->lanIp = '172.19.97.179';
|
||||
$gateway->lanIp = env('worker.address');
|
||||
|
||||
// 内部通讯起始端口,假如$gateway->count=2,起始端口为2900
|
||||
// 则一般会使用3900 3901 3902 3903 4个端口作为内部通讯端口
|
||||
$gateway->startPort = 3900;
|
||||
$gateway->startPort = env('worker.start_port');
|
||||
|
||||
// 服务注册地址
|
||||
$gateway->registerAddress = '172.19.97.179:1256';
|
||||
$gateway->registerAddress = env('worker.address').':'.env('worker.port');
|
||||
|
||||
// 心跳间隔
|
||||
$gateway->pingInterval = 20;
|
@ -3,10 +3,10 @@ use \Workerman\Worker;
|
||||
use \GatewayWorker\Register;
|
||||
|
||||
// 自动加载类
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../../../../vendor/autoload.php';
|
||||
|
||||
// register 必须是text协议,切记不能将register端口开放给外网
|
||||
$register = new Register('text://172.19.97.179:1256');
|
||||
$register = new Register('text://'.env('worker.address').':'.env('worker.port'));
|
||||
|
||||
// 如果不是在根目录启动,则运行runAll方法
|
||||
if(!defined('GLOBAL_START'))
|
@ -29,7 +29,7 @@ define('GLOBAL_START', 1);
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
// 加载所有Applications/*/start.php,以便启动所有服务
|
||||
foreach(glob(__DIR__.'/extend/workerim/start*.php') as $start_file)
|
||||
foreach(glob(__DIR__.'/app/common/service/workerim/start*.php') as $start_file)
|
||||
{
|
||||
require_once $start_file;
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
CHCP 65001
|
||||
php extend\workerim\start_register.php extend\workerim\start_gateway.php extend\workerim\start_businessworker.php
|
||||
php app\common\service\workerim\start_register.php app\common\service\workerim\start_gateway.php app\common\service\workerim\start_businessworker.php
|
||||
pause
|
Loading…
x
Reference in New Issue
Block a user