PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key)
MIT License
369
stars
119
forks
source link
Sometimes message not send to all the device tokens #35
Sometimes (5 out of 10 times) not all messages were send to all the devicetokens.
We discovered that sometimes the connection breaks in the while loop in Client.php without any reason.
After investigation we discovered adding this line solves the problem:
...
while (($execrun = curl_multi_exec($mh, $running)) == CURLM_CALL_MULTI_PERFORM);
if ($execrun != CURLM_OK) {
break;
}
//ADDED THIS AFTER CURLM_OK
if ($running && curl_multi_select($mh) === -1) {
usleep(250);
}
while ($done = curl_multi_info_read($mh)) {
...
Don't know why. But after we had made this change, we hadn't had issues anymore.
Hope this helps someone.
Sometimes (5 out of 10 times) not all messages were send to all the devicetokens.
We discovered that sometimes the connection breaks in the while loop in Client.php without any reason. After investigation we discovered adding this line solves the problem:
... while (($execrun = curl_multi_exec($mh, $running)) == CURLM_CALL_MULTI_PERFORM);
if ($execrun != CURLM_OK) { break; }
//ADDED THIS AFTER CURLM_OK if ($running && curl_multi_select($mh) === -1) { usleep(250); }
while ($done = curl_multi_info_read($mh)) { ...
Don't know why. But after we had made this change, we hadn't had issues anymore. Hope this helps someone.
Curl version: 7.52.1