1

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?

kotAPI
  • 1,073
  • 2
  • 13
  • 37

2 Answers2

0

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.

HaVoK
  • 13
  • 7
  • hi,thank u for ur reply.How i check whether the connection is lost or not?Iam using ssl://gateway.sandbox.push.apple.com:2195.Is there any mistake?How we check the port is open or not.But i thing is i got notification rarely.how is it possible. – user3226620 Jan 27 '14 at 03:58
  • hi,can u please reply soon – user3226620 Jan 28 '14 at 03:47
  • how i lose the connection during push notification?can u please reply soon – user3226620 Jan 28 '14 at 07:07
  • one more thing i noticed is that when i started getting notification, 3 to 4 times i got it .After that i got the above error.Then for long time i got the error then got pushnotification.what was the problem – user3226620 Jan 28 '14 at 07:17
0

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.

Dinesh
  • 2,194
  • 3
  • 30
  • 52
  • Thank u for ur reply.i agree to ur answer.php script shows error most time and send notification rarely.i got notification whenever php shows message successfully delivered. – user3226620 Jan 27 '14 at 04:00
  • hi,can u please reply soon – user3226620 Jan 28 '14 at 03:46
  • I am not sure what you need now. Have a look at this http://stackoverflow.com/questions/13897575/apns-apple-push-notification-service-reliability – Dinesh Jan 28 '14 at 03:49
  • i think my problem is not reliability.can i ask one doubt?how i check whether the ports are open or not in my server?Is the port change from open to close or viceversa.i tried lot.no way.can u please please help me – user3226620 Jan 28 '14 at 06:34
  • iam using filezila to connect to server. – user3226620 Jan 28 '14 at 06:43