标签:增加 client reload cli timer 集群 func ada web
<?php
use Workerman\Worker;
use Workerman\Lib\Timer;
require_once ‘../../web/Workerman/Autoloader.php‘;
require_once ‘../../web/Channel/src/Client.php‘;
require_once ‘../../web/Channel/src/Client.php‘
$worker = new Worker(‘text://0.0.0.0:8989‘);
$worker->count = 1;
$worker->reloadable = false; //平滑重启
$worker->onConnect = function ($con)use($worker)
{
foreach($worker->connections as $connection){
$connection->send($con->id.‘上线了‘);
}
};
//群发通知 这里只支持单进程的 $worker->count = 1; 如需支持多进程 可使用getway框架 或者引用Channel组件
Worker::runAll();
work单进程群发通知 后面会增加Channel组件的分组推送以及集群推送篇章
标签:增加 client reload cli timer 集群 func ada web
原文地址:http://www.cnblogs.com/jasonxiaoqinde/p/7457467.html