Has anyone come up with the correct way to push a message to multiple devices. We are developing an app that has followers and like Facebook or Twitter, I need to send a message to a persons followers (600 in all).
In PHP I just did a test and each message takes about 20 seconds for a reply to come back from
$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err,
$errstr, 60, STREAM_CLIENT_CONNECT, $ctx);
and
// Send it to the server
$result = fwrite($fp, $msg, strlen($msg));
This would result in it taking 3 hours to send 600 messages?
For each message I’m executing the same lines of code. Should I instead be opening up the stream and just issuing multiple writes and then fpclose?
1 Answer