1
有没有办法一次发送多个推送消息?一次发送多个推送与c2dm
昨天发送100条消息需要38秒,时间太长。
我拿到身份验证令牌只有一次,我使用:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://android.apis.google.com/c2dm/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: GoogleLogin auth=$authCode"));
$post_fields = "registration_id=" . urlencode($deviceToken)
. "&".$payload
. "&collapse_key=$key";
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
$response = curl_exec($ch);
curl_close($ch);
if (strpos($response, '200 OK') !== false) {
return true;
}
else echo $response." ";
return false;
每个推送令牌我。
有没有更快的方法?
谢谢