當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IoServer::run方法代碼示例

本文整理匯總了PHP中Ratchet\Server\IoServer::run方法的典型用法代碼示例。如果您正苦於以下問題:PHP IoServer::run方法的具體用法?PHP IoServer::run怎麽用?PHP IoServer::run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Ratchet\Server\IoServer的用法示例。


在下文中一共展示了IoServer::run方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: start

 /**
  * Start Server
  */
 public function start()
 {
     $loop = $this->createLoop();
     $socket = $this->createSocket($loop, $this->port, $this->address);
     $ioServer = new IoServer($this->component, $socket, $loop);
     $this->logStart();
     $ioServer->run();
 }
開發者ID:bfoxwell,項目名稱:votifier,代碼行數:11,代碼來源:Server.php

示例2: socket_server

 /**
  * This method initialize the socket server
  *
  */
 public function socket_server()
 {
     if (!is_cli()) {
         echo "This controller must run from command line interface only.\n";
         return;
     }
     echo __DIR__;
     $this->load->library('websocket_application');
     $this->load->model('user_model');
     $loop = Factory::create();
     $socket = new Server($loop);
     $socket->listen('8087', '0.0.0.0');
     echo "Created websocket: ws://0.0.0.0:8087/\n";
     $routes = new RouteCollection();
     $users = $this->user_model->get_records();
     foreach ($users as $user) {
         $routes->add($user->record_id, new Route('/' . $user->record_id, array('_controller' => new WsServer(new Websocket_application()))));
         echo "Created route: /" . $user->record_id . "\n";
     }
     $context = new RequestContext();
     $matcher = new UrlMatcher($routes, $context);
     $server = new IoServer(new HttpServer(new Router($matcher)), $socket, $loop);
     $server->run();
 }
開發者ID:alexandrosIor,項目名稱:Catering,代碼行數:28,代碼來源:Shell.php

示例3: run

 /**
  * Run the server by entering the event loop
  */
 public function run()
 {
     $this->server->run();
 }
開發者ID:owlycode,項目名稱:reactboard,代碼行數:7,代碼來源:RachetApp.php

示例4: testNoLoopProvidedError

 public function testNoLoopProvidedError()
 {
     $this->setExpectedException('RuntimeException');
     $io = new IoServer($this->app, $this->reactor);
     $io->run();
 }
開發者ID:rsrodrig,項目名稱:MeetMeSoftware,代碼行數:6,代碼來源:IoServerTest.php

示例5: Api

$argsize = count($argv);
if ($argsize == 1) {
    echo colorize("Please specify a base uri eg.", "red") . colorize(" http://myhost.com/movim/\n", 'yellow');
    exit;
}
if ($argsize == 2) {
    echo colorize("Please specify a port eg.", "red") . colorize(" 8080\n", 'yellow');
    exit;
}
$md = Modl\Modl::getInstance();
$infos = $md->check();
if ($infos != null) {
    echo colorize("The database need to be updated before running the daemon\n", 'green');
    foreach ($infos as $i) {
        echo colorize($i . "\n", 'blue');
    }
    echo colorize("\nTo update the database run\n", 'green');
    echo colorize("php mud.php db --set\n", 'purple');
    exit;
}
$loop = Factory::create();
$core = new Core($loop, $argv[1], $argv[2]);
$app = new HttpServer(new WsServer($core));
$socket = new Reactor($loop);
$socket->listen($argv[2], '127.0.0.1');
$socketApi = new Reactor($loop);
new Api($socketApi, $core);
$socketApi->listen(1560);
$server = new IoServer($app, $socket, $loop);
$server->run();
開發者ID:Anon215,項目名稱:movim,代碼行數:30,代碼來源:daemon.php

示例6: run

 /**
  * Starts the prepared server.
  *
  * @return Freestream\WebSocket\WebSocketServer
  */
 public function run()
 {
     $this->server->run();
     return $this;
 }
開發者ID:Hehe-Zhc,項目名稱:laravel-websocket,代碼行數:10,代碼來源:WebSocketServer.php


注:本文中的Ratchet\Server\IoServer::run方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。