在你的项目中使用SwooleServer实例

  1. /**
  2. * 如果启用WebSocket server,$swoole是`Swoole\WebSocket\Server`的实例,否则是是`Swoole\Http\Server`的实例
  3. * @var \Swoole\WebSocket\Server|\Swoole\Http\Server $swoole
  4. */
  5. $swoole = app('swoole');
  6. var_dump($swoole->stats());// 单例