1
votes

I am an iphone developer.I am trying for push notification . I created certificates,provisional profiles and php script.And i try to run in terminal,then it work nice.But when i upload it in my server,notification come sometimes mostly it show following error

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection refused) Failed to connect: 111 Connection refused I placed the ck.pem file in the same directory of php file. Does it require to add the path?

2
which certificate (ck.pem) you are using production or development ?Ankush
hi,sorry for delay.iam using ck.pem for development.How i check whether the connection is lost or not?But one thing is i got notification rarely.how is it possible?user3226620
hi,can u please reply soonuser3226620

2 Answers

0
votes

it seems you lose the connection during the push notification, and yes you should add the path make sure you double check that the port your using is correct and open.

0
votes

Also note that Push notification is also not always guaranteed. You can refer 'More about Push notification' section in https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/WhatAreRemoteNotif.html

Quality of Service

Apple Push Notification Service includes a default Quality of Service (QoS) component that
performs a store-and-forward function. If APNs attempts to deliver a notification but the device 
is offline, the QoS stores the notification. It retains only one notification per application 
on a device: the last notification received from a provider for that application. 
When the offline device later reconnects, the QoS forwards the stored notification to the device.
The QoS retains a notification for a limited period before deleting it.

If a device is offline (either turned off or just unreachable) then it will receive at most a single push notification you attempt to send to your application during that time.