onSleep() public méthode

Called when the request starts sleep
public onSleep ( ) : void
Résultat void
Exemple #1
0
 /**
  * onFrame
  * @param  string $msg [@todo description]
  * @param  integer $type [@todo description]
  * @return void
  */
 public function onFrame($msg, $type)
 {
     $frames = json_decode($msg, true);
     if (!is_array($frames)) {
         return;
     }
     $this->route->onWakeup();
     foreach ($frames as $frame) {
         try {
             $this->route->onFrame($frame, \PHPDaemon\Servers\WebSocket\Pool::STRING);
         } catch (\Exception $e) {
             Daemon::uncaughtExceptionHandler($e);
         }
     }
     $this->route->onSleep();
 }
Exemple #2
0
 /**
  * Called when the request starts sleep
  * @return void
  */
 public function onSleep()
 {
     if (!Daemon::$obInStack) {
         // preventing recursion
         @ob_flush();
     }
     unset($_GET);
     unset($_POST);
     unset($_COOKIE);
     unset($_REQUEST);
     unset($_SESSION);
     unset($_FILES);
     unset($_SERVER);
     parent::onSleep();
 }