Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带Laravel 5的棘轮_Laravel_Laravel 5_Ratchet - Fatal编程技术网

带Laravel 5的棘轮

带Laravel 5的棘轮,laravel,laravel-5,ratchet,Laravel,Laravel 5,Ratchet,我正在尝试将Ratchet与Laravel结合起来 我在Command类的handle()中添加了以下内容 public function handle() { $this->info('Server running'); $loop = Factory::create(); $webSock = new Server($loop); $webSock->listen(8080, '0.0.0.0'); $webServer = new

我正在尝试将Ratchet与Laravel结合起来

我在Command类的handle()中添加了以下内容

public function handle()
{


    $this->info('Server running');
    $loop = Factory::create();
    $webSock = new Server($loop);
    $webSock->listen(8080, '0.0.0.0');

    $webServer = new IoServer(
        new HttpServer(
            new WsServer(
                new WampServer(
                    new EventHandler($loop) // This is my class. Pass in the loop!
                )
            )
        ),
        $webSock
    );

    $loop->run();
    }
从CLI执行此命令时工作正常

现在,如果在控制器中添加以下代码,会产生什么效果:

Bus::dispatch(
    new RatchetCommand()
);

将启动服务器的多个实例吗?因为该控制器将被多次调用。

在其中创建路由并调用ratchet命令。您可以通过使用Artisan facade来实现这一点。像Artisan::call(“commandName”);我可以调用它,但问题是服务器的多个实例是否会启动?