Git Product home page Git Product logo

Comments (5)

adobkin avatar adobkin commented on August 22, 2024

You can't, apple closes connection if token is invalid. You should reconnect and resent any notifications you sent after it

from php-apn.

seme1 avatar seme1 commented on August 22, 2024

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.

rgomezcasas avatar rgomezcasas commented on August 22, 2024

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.

adobkin avatar adobkin commented on August 22, 2024

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.

rgomezcasas avatar rgomezcasas commented on August 22, 2024

Ahh ok, @adobkin thank you very much!

from php-apn.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.