Skip to content

Commit

Permalink
Merge pull request #11 from Sumukh/master
Browse files Browse the repository at this point in the history
Stream Client Connect and Persistent.
  • Loading branch information
peter-schmalfeldt committed Sep 6, 2011
2 parents 9300702 + 74f3045 commit 4fb05c3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/php/classes/class_APNS.php
Expand Up @@ -393,7 +393,8 @@ private function _pushMessage($pid, $message, $token, $development){

$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', $this->apnsData[$development]['certificate']);
$fp = stream_socket_client($this->apnsData[$development]['ssl'], $error, $errorString, 60, STREAM_CLIENT_CONNECT, $ctx);
$fp = stream_socket_client($this->apnsData[$development]['ssl'], $error, $errorString, 100, (STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT), $ctx);


if(!$fp){
$this->_pushFailed($pid);
Expand Down Expand Up @@ -427,7 +428,7 @@ private function _checkFeedback($development){
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', $this->apnsData[$development]['certificate']);
stream_context_set_option($ctx, 'ssl', 'verify_peer', false);
$fp = stream_socket_client($this->apnsData[$development]['feedback'], $error, $errorString, 60, STREAM_CLIENT_CONNECT, $ctx);
$fp = stream_socket_client($this->apnsData[$development]['feedback'], $error,$errorString, 100, (STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT), $ctx);

if(!$fp) $this->_triggerError("Failed to connect to device: {$error} {$errorString}.");
while ($devcon = fread($fp, 38)){
Expand Down

0 comments on commit 4fb05c3

Please sign in to comment.