Code Monkey home page Code Monkey logo

Comments (6)

manuel-rubio avatar manuel-rubio commented on May 26, 2024

when the connection is done to the feedback service, you'll receive those tokens, expired tokens, and you are responsible to remove them from your database (if you consider the token is not valid anymore).

The callback where you'll receive this is described here:

https://github.com/inaka/apns4erl#feedback-channel-and-getting-errors

handle_apns_delete_subscription({Timestamp, Token}) here you'll receive one by one all of those expired tokens.

from apns4erl.

monkeyfdude avatar monkeyfdude commented on May 26, 2024

Clarifications needed please:

There are two ways we can get feedback

  1. When we send_message(INVALID_DEVICE_TOKEN), here we get a feedback that token is not valid
  2. As you mentioned above in your comment, when we open the connection to feedback service we start getting those tokens one by one
  • In both cases wiil it be the same callback or will it be different callbacks?
  • Do both cases share the same connection to the feedback service?
  • I notice that feedback connection gets disconnected. What will happen if feedback connection is disconnected and I send_message for invalid device token. Since feedback connection was down, how will the feedback callback be invoked?

Best Regards,

from apns4erl.

manuel-rubio avatar manuel-rubio commented on May 26, 2024

Of course not. If you see the link above, you realize there're 2 callbacks. I was referring only to the second one, because you was asking about that, but you can implement both to handle the different incoming messages.

from apns4erl.

monkeyfdude avatar monkeyfdude commented on May 26, 2024

I apologize but after looking at the link only, I got confused.

How many total callbacks will be implemented - Two or Three

  1. handle_apns_error/2 ------- used FOR send_message(...) for ERRORS

  2. handle_apns_delete_subscription/1 --------> used FOR send_message(....) for DELETE_SUBSCR

  3. handle_apns_delete_subscription/1 ------------> used BY feedback_connection for DELETE_SUBSCR

If two in total need to be implemented, then what will happen for send_message(DELETE_SUBSCR) call when Feedback Connection is NOT there

If three in total need to be implemented, my confusion is how do I provide reference to the third callback function.

Here we only give reference to two callback functions, one of which is for ERRORS

apns:connect(
%% your connection identifier:
my_connection_name,
%% called in case of a "hard" error:
fun ?MODULE:handle_apns_error/2,
%% called if the device uninstalled the application:
fun ?MODULE:handle_apns_delete_subscription/1
).

I think my confusion comes from that I assume for send_message(DELETE_SUBSCR) call, Feedback (different from error) will be sent right away by Apple APNS to apns4erl.

But I think the behavior would be that feedback of expired tokens token will only come when feedback connection is up next time. Is that the case?

from apns4erl.

manuel-rubio avatar manuel-rubio commented on May 26, 2024

yes, is that.

from apns4erl.

monkeyfdude avatar monkeyfdude commented on May 26, 2024

Thank you very much for helping me out!!!

from apns4erl.

Related Issues (20)

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.