Question

I'm using Apns-PHP library to send Apple Push Notifications. It was functioning correctly, certificates fine, huge amount of pushes were sent out in the recent past.

For a while though, it cannot connect to the Apple service. This is strange because nothing changed on our side. In fact, nobody touched the server for a long while.

Do you know if anything changed on Apple's side that could prevent the connection?

Here is a log sample from my server:

Tue, 04 Feb 2014 03:54:42 +0000 NmPns[7799]: INFO: Starting Job (job ID: 581 ; env: 2)
Tue, 04 Feb 2014 03:54:42 +0000 NmPns[7799]: INFO: Preparing job - building queue.
Tue, 04 Feb 2014 04:10:38 +0000 NmPns[7799]: INFO: Built queue (device count: 421335)
Tue, 04 Feb 2014 04:10:39 +0000 NmPns[7799]: INFO: Connecting to Apple server...
Tue, 04 Feb 2014 04:10:39 +0000 ApnsPHP[7799]: INFO: Trying ssl://gateway.push.apple.com:2195...
Tue, 04 Feb 2014 04:10:40 +0000 ApnsPHP[7799]: ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195':  (0)
Tue, 04 Feb 2014 04:10:40 +0000 ApnsPHP[7799]: INFO: Retry to connect (1/3)...
Tue, 04 Feb 2014 04:10:41 +0000 ApnsPHP[7799]: INFO: Trying ssl://gateway.push.apple.com:2195...
Tue, 04 Feb 2014 04:10:41 +0000 ApnsPHP[7799]: ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195':  (0)
Tue, 04 Feb 2014 04:10:41 +0000 ApnsPHP[7799]: INFO: Retry to connect (2/3)...
Tue, 04 Feb 2014 04:10:42 +0000 ApnsPHP[7799]: INFO: Trying ssl://gateway.push.apple.com:2195...
Tue, 04 Feb 2014 04:10:43 +0000 ApnsPHP[7799]: ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195':  (0)
Tue, 04 Feb 2014 04:10:43 +0000 ApnsPHP[7799]: INFO: Retry to connect (3/3)...
Tue, 04 Feb 2014 04:10:44 +0000 ApnsPHP[7799]: INFO: Trying ssl://gateway.push.apple.com:2195...
Tue, 04 Feb 2014 04:10:44 +0000 ApnsPHP[7799]: ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195':  (0)
Tue, 04 Feb 2014 04:10:44 +0000 NmPns[7799]: ERROR: Aborting job! Cannot connect to server. Message: Unable to connect to 'ssl://gateway.push.apple.com:2195':  (0)
Was it helpful?

Solution

Maybe your certificate has expired? Go into your developer console, in the Certificates section. Look into the app id of your app if the push notifications are "Enabled" or "Configurable"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top