I want to have my sockets seperatly, but to run a server i need to use runAll() function. Because of this, starting second server after the first one will crush it and second will be only one working. Example:
First.php
class First
{
private $worker;
public function actionRun()
{
$this->worker = new Worker('websocket://0.0.0.0:8090');
$this->worker->name = 'websocket1';
$this->worker->count = 1;
$this->worker->reloadable = true;
$this->worker->onMessage= function ($connection) {
$connection->send("data");
}
Worker::$daemonize = true;
$this->worker->runAll();
}
}
Second.php
class Second
{
private $worker;
public function actionRun()
{
$this->worker = new Worker('websocket://0.0.0.0:8091');
$this->worker->name = 'websocket2';
$this->worker->count = 1;
$this->worker->reloadable = true;
$this->worker->onMessage= function ($connection) {
$connection->send("data");
}
Worker::$daemonize = true;
$this->worker->runAll();
}
}
I want to have my sockets seperatly, but to run a server i need to use
runAll()
function. Because of this, starting second server after the first one will crush it and second will be only one working. Example:First.php
Second.php