Example #1
0
 /**
  * Poll the API for updated information -- Simulate an API call of varying duration.
  * @param Credential $credential
  * @return void
  * @throws \ConnectionException
  */
 public function poll(Credential $credential)
 {
     $client = new Client($credential, Pdo::createInstance(), new CoreWorkerMediator($this->mediator));
     try {
         while (true) {
             $client->pollMessages();
             $client->sendMessages();
         }
     } catch (\Exception $e) {
         $this->mediator->log("error: " . $e->getMessage() . "\n" . $e->getTraceAsString());
     }
 }