Comments (5)
You can't, apple closes connection if token is invalid. You should reconnect and resent any notifications you sent after it
from php-apn.
Can you please give an example for how to receover from a closed connection ? In particular, my question is related to the case when sending a single message to a large number of devices.
apn_payload_set_array($payload, array(
'body' => 'This push was sent using PHP && php-apn',
'sound' => 'default',
'badge' => 34,
'tokens' => array (
'device1Token',
'device2Token',
'device3Token',
... // and many more
)
));
from php-apn.
I'm trying to retrieve the devices invalids tokens
if (apn_feedback_connect($apn, $error, $errcode)) {
$tokens = apn_feedback($apn, $error, $errcode);
if ( ! is_array($tokens)) {
echo 'Failed to obtain device tokens: ' . $error;
} else {
foreach($tokens as $token) {
echo 'Token: '.$token;
}
}
} else {
echo 'Failed to connect to Apple Push Feedback Service: ' . $error;
}
Previously I'm forcing invalid devices tokens but still this is returning me $tokens
empty array.
from php-apn.
apn_feedback shan't return invalid tokens. It's return tokens from removed app
The Apple Push Notification service includes a feedback service to give you information about failed remote notifications. When a remote notification cannot be delivered because the intended app does not exist on the device, the feedback service adds that device’s token to its list
from php-apn.
Ahh ok, @adobkin thank you very much!
from php-apn.
Related Issues (13)
- apn_payload_add_custom_property doesn't work with string values HOT 1
- Errors installing on most recent version of PHP, Ubuntu, etc. HOT 5
- PHP Warning: apn_feedback(): failed to set localized key: server closed connection (SSL_ERROR_ZERO_RETURN) (4) in HOT 7
- Segmentation Fault (11) HOT 2
- Using it without installing HOT 1
- Links to libcapn.org to php-apn HOT 1
- the install procedure stopped at "make" HOT 3
- Need functions to set priority
- too many arguments to function ‘apn_feedback’
- AWS yum install
- Feature request: Ability to set "title" (child property of "alert") in payload
- Error installing in ubuntu 14.04 - make: *** [php_apn.lo] Error 1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-apn.