예제 #1
0
 /**
  * @covers easyServer::__construct
  * @covers easyServer::setConfig
  * @covers easyServer::start
  */
 public function setUp()
 {
     $this->port = $this->config['port'];
     $this->loop = $this->createLoop();
     $this->server = new easyServer($this->loop);
     $this->server->setConfig($this->config);
     $this->server->start();
 }
예제 #2
0
<?php

use React\EventLoop;
use greevex\react\easyServer\server\easyServer;
use greevex\react\easyServer\examples\exampleServer;
require_once __DIR__ . '/bootstrap.php';
$serverConfig = ['host' => '127.0.0.1', 'port' => 9089, 'protocol' => exampleServer\exampleProtocol::class, 'communication' => exampleServer\exampleCommunication::class];
$loop = EventLoop\Factory::create();
error_log('[server] Starting...');
$server = new easyServer($loop);
$server->setConfig($serverConfig);
$server->start();
$loop->run();