Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apns php error "Failed to connect to APNS: 110 Connection timed out."

I have done apns code for php and objective c from this Apns code

and setup certificate from this link

Sandbox and production apns for sending notification to ios devices is working perfectly on my server.I moved code and same certificate to client server then sending notification is not working.

I debug all php code and found that it stops at this line of code

private function _connectSSLSocket($development) {
    $ctx = stream_context_create();
    stream_context_set_option($ctx, 'ssl', 'local_cert', $this->apnsData[$development]['certificate']);
    $this->sslStreams[$development] = stream_socket_client($this->apnsData[$development]['ssl'], $error, $errorString, 100, (STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT), $ctx);
    if(!$this->sslStreams[$development]){
        $this->_triggerError("Failed to connect to APNS: {$error} {$errorString}.");
        unset($this->sslStreams[$development]);
        return false;
    }
    return $this->sslStreams[$development];
}

apns.log file shows the error "Failed to connect to APNS: 110 Connection timed out."

Not getting the mistake. Why this error am i getting and not sending notification to ios devices ? Can anyone guide me for this ?

like image 624
Viral Narshana Avatar asked Oct 03 '22 20:10

Viral Narshana


1 Answers

Finally i took vps instead of shared hosting. Lucabro's comments helped me to solve. Thanks Lucabro.

like image 148
Viral Narshana Avatar answered Oct 07 '22 20:10

Viral Narshana