当前位置: 首页>>代码示例>>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;未经允许,请勿转载。