<?phpuse 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();