/**
  * Main server loop
  *
  * @return void This method does not return!
  */
 public function run()
 {
     $this->connectionManager->listen();
     while (true) {
         /*
          * If there's nothing changed on any of the sockets, the server
          * will sleep and other processes will have a change to run. Control
          * this behaviour with the timeout options.
          */
         $this->connectionManager->selectAndProcess();
     }
 }
Ejemplo n.º 2
0
 /**
  * Main server loop
  *
  * @return void This method does not return!
  */
 public function run()
 {
     $this->connectionManager->listen();
     while (true) {
         /*
          * If there's nothing changed on any of the sockets, the server
          * will sleep and other processes will have a change to run. Control
          * this behaviour with the timeout options.
          */
         $this->connectionManager->selectAndProcess();
         /*
          * If the application wants to perform periodic operations or queries and push updates to clients based on the result then that logic can be implemented in the 'onUpdate' method.
          */
         foreach ($this->applications as $application) {
             if (method_exists($application, 'onUpdate')) {
                 $application->onUpdate();
             }
         }
     }
 }