php - How can I send push notification to multiple devices in one go in iPhone? -


i want send same messages devices registered application how can send them without making multiple connections...

my current php code:

ctx = stream_context_create();   stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');   $fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, stream_client_connect, $ctx);   if (!$fp) {   print "failed connect $err $errstr\n";   return; } $msg = chr(0) . pack("n",32) . pack('h*', str_replace(' ', '', $devicetoken)) . pack("n",strlen($payload)) . $payload; fwrite($fp, $msg); 

bottom line, can't. need send message each token.

its not working email can have multiple recipients.

once connection open can send bunch of messages, thats preferred way (based on apples sdk).

from sdk:

http://developer.apple.com/library/mac/#documentation/networkinginternet/conceptual/remotenotificationspg/communicatingwithaps/communicatingwithaps.html#//apple_ref/doc/uid/tp40008194-ch101-sw2

you should retain connections apns across multiple notifications. apns may consider connections rapidly , repeatedly established , torn down denial-of-service attack. upon error, apns closes connection on error occurred.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -