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;
每個推送令牌我。
有沒有更快的方法?
謝謝