Skip to content

Commit

Permalink
Merge branch 'release/0.0.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
hswong3i committed Sep 24, 2014
2 parents a7f1e8d + 1a8a07c commit 7065cf4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/AuthBucket/Push/ServiceType/ApnsServiceTypeHandler.php
Expand Up @@ -111,16 +111,19 @@ public function send(Request $request)
// Prepare the payload in JSON format.
$payload = json_encode(array(
'aps' => array(
'alert' => $data,
'alert' => $data['message'],
'badge' => 1,
'sound' => 'default',
),
));

// Build the message.
$message = chr(0).chr(0);
$message .= chr(32).pack('H*', $device->getDeviceToken());
$message .= chr(strlen($payload)).$payload;
$message = pack('CnH*', 1, 32, $device->getDeviceToken());
$message .= pack('Cn', 2, strlen($payload)).$payload;
$message .= pack('CnN', 3, 4, md5(uniqid(null, true)));
$message .= pack('CnN', 4, 4, 60*60*24*7);
$message .= pack('CnC', 5, 1, 10);
$message = pack('CN', 2, strlen($message)).$message;

// Create and write to the stream.
$context = stream_context_create();
Expand All @@ -130,8 +133,8 @@ public function send(Request $request)
$options['host'],
$error,
$errorString,
3,
STREAM_CLIENT_CONNECT,
10,
STREAM_CLIENT_ASYNC_CONNECT,
$context
);
fwrite($handler, $message);
Expand Down
Expand Up @@ -28,7 +28,7 @@ public function load(ObjectManager $manager)
$manager->persist($model);

$model = new Device();
$model->setDeviceToken('7be07f1e5e1737f2aec000a0cc82da06')
$model->setDeviceToken('APA91bFwYKY0qonK0xg_lHMe-zcwaoeNsjGBMKDND-HspWOgbfsMYJyNqAlhSBbcc9WmxmVOyJk_jYJKUzwg22NFnK44w5f0PvC_ugXJR9MnBgvl5sgbPP9VeMIVAr9gH-3xz09ObfORaBTYfwQ7YrJuZ0CIAfHyvMmxNLu_hxtzXCMXx3xtdY8')
->setServiceType('gcm')
->setClientId('http://democlient1.com/')
->setUsername('demousername1')
Expand Down

0 comments on commit 7065cf4

Please sign in to comment.