public function perform()
 {
     if (isset($this->args['delay'])) {
         $now = new \DateTime();
         $delay = \DateTime::createFromFormat('U', $this->args['delay']);
         if ($delay > $now) {
             Client::enqueueFromJobArgs($this->args);
             return;
         }
     }
     $response = Sender::send(Message::fromArray($this->args['message']), $this->args['serverApiKey'], $this->args['gcmUrl'], isset($this->args['nextDelay']) ? $this->args['nextDelay'] : 1);
     /**
      * Response can be:
      *  - DateTime: When to next retry sending the message.
      *  - Response: Valid response that must be processed.
      *  - Integer:  Exponential Back off.
      */
     if ($response instanceof \DateTime) {
         $this->args['delay'] = $response->format('U');
         Client::enqueueFromJobArgs($this->args);
     } elseif ($response instanceof Response) {
         $failed = $response->getFailedIds();
         foreach ($failed as $error => $group) {
             switch ($error) {
                 case 'Unavailable':
                     $message = $this->args['message'];
                     $message['registration_ids'] = [];
                     foreach ($group as $id => $item) {
                         $message['registration_ids'][] = $id;
                     }
                     Client::enqueueFromJobArgs(['serverApiKey' => $this->args['serverApiKey'], 'gcmUrl' => $this->args['gcmUrl'], 'message' => $message]);
                     break;
                 case 'InternalServerError':
                     foreach ($group as $item) {
                         throw new PhpGcmQueueException('GCM\\DefaultSendJob->perform - Unknown Error: ' . $item, PhpGcmQueueException::UNKNOWN_ERROR);
                     }
                     break;
                 default:
                     /**
                      * The following error messages should remove the Registration IDs from records.
                      *  - InvalidRegistration
                      *  - NotRegistered
                      */
                     /**
                      * The following error messages are malformed requests:
                      *  - MissingRegistration
                      *  - InvalidPackageName
                      *  - MismatchSenderId
                      *  - InvalidDataKey
                      */
                     /**
                      * The follow error messages are throttling (immediately stop sending, do not retry):
                      *  - DeviceMessageRate Exceeded
                      *  - TopicsMessageRate Exceeded
                      */
                     /**
                      * The follow error messages should never occur since they are explicitly tested for:
                      *  - MessageTooBig
                      *  - InvalidTtl
                      */
                     break;
             }
         }
         $this->response = $response;
     } elseif (is_numeric($response)) {
         $this->args['delay'] = \DateTime::createFromFormat('U', strtotime('now +' . (int) $response . ' seconds'))->format('U');
         $this->args['nextDelay'] = $response * 2;
         Client::enqueueFromJobArgs($this->args);
     }
 }