/** * Queue a message on the correct APNS gateway connection * * @param Message The message to queue * @param int The times Notificato should retry to deliver the message on failure (deprecated and ignored) * @return MessageEnvelope */ public function queue(Message $message) { // Get the gateway for the certificate $gateway = $this->getGatewayForCertificate($message->getCertificate()); // Queue the message return $gateway->queue($message); }
/** * Create a Message builder * * @return Apns\MessageBuilder */ public function messageBuilder() { $builder = Apns\Message::builder(); if ($this->certificateFactory->getDefaultCertificate() != null) { $builder->setCertificate($this->certificateFactory->getDefaultCertificate()); } return $builder; }
public function testGetJson() { $certificate = new Certificate(__DIR__ . '/../resources/certificate_corrupt.pem', null, false, Certificate::ENDPOINT_ENV_PRODUCTION); $message = new Message('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', $certificate, 'alert', 3, 'sound', array('payload' => array('some' => 'payloadhere')), 'mycategory', true, new \DateTime('1970-01-01T00:01:00Z')); $this->assertJsonStringEqualsJsonString(json_encode(array('payload' => array('some' => 'payloadhere'), 'aps' => array('badge' => 3, 'alert' => 'alert', 'sound' => 'sound', 'category' => 'mycategory', 'content-available' => 1)), JSON_FORCE_OBJECT), $message->getJson()); }