onSessionStart() public method

Handles session start
public onSessionStart ( ClientSession $session, Thruway\Transport\TransportProviderInterface $transport )
$session Thruway\ClientSession
$transport Thruway\Transport\TransportProviderInterface
コード例 #1
0
 /**
  * @inheritDoc
  */
 public function onSessionStart($session, $transport)
 {
     parent::onSessionStart($session, $transport);
     $connection = new React\MySQL\Connection($this->getLoop(), array('dbname' => 'thruway_auth_example', 'user' => 'root', 'passwd' => 'root', 'port' => 8889));
     //connecting to mysql server, not required.
     $connection->connect(function () {
     });
     $this->mysqlConnection = $connection;
 }
コード例 #2
0
ファイル: AuthProvider.php プロジェクト: voryx/ThruwayDrupal
 public function onSessionStart($session, $transport)
 {
     parent::onSessionStart($session, $transport);
     $loop = $this->getLoop();
     $loop->addPeriodicTimer(30, function () use($session, $loop) {
         $this->getLogger()->info("Sending a Ping from auth provider\n");
         $session->ping(5);
         $loop->tick();
     });
 }