Comments (6)
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.
Clarifications needed please:
There are two ways we can get feedback
- When we send_message(INVALID_DEVICE_TOKEN), here we get a feedback that token is not valid
- 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.
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.
I apologize but after looking at the link only, I got confused.
How many total callbacks will be implemented - Two or Three
-
handle_apns_error/2 ------- used FOR send_message(...) for ERRORS
-
handle_apns_delete_subscription/1 --------> used FOR send_message(....) for DELETE_SUBSCR
-
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.
yes, is that.
from apns4erl.
Thank you very much for helping me out!!!
from apns4erl.
Related Issues (20)
- adding coverage in Travis
- Increase test coverage
- Connections using Provider Auth Token HOT 1
- how to send mutiple token to apns in one time? HOT 4
- Rebar compile issues when included in other projects HOT 1
- version bump to 2.3.1
- New 2.4.0 release HOT 2
- apns:connect error HOT 3
- Maintenance-related issues HOT 9
- Move from Travis CI to GitHub Actions? HOT 2
- Release request HOT 2
- CRASH gun_http2:parse in server logs HOT 26
- src/apns_connection.erl:22: Warning: undefined callback function terminate/3 (behaviour 'gen_statem') HOT 12
- Erlang (Not apns4erl) Question HOT 3
- With gun-2.0.0-rc.1, apns reconnections are much more frequent than with gun-1.3.3 HOT 3
- timeout key is expected but its presence is not verified in apns_connection:init/1
- Improvements from Akick HOT 4
- Function not exported {string,lowercase,1} HOT 3
- apns crashes with {case_clause,{error,{closed,"The connection was lost."}}
- push current master to hex.pm 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 apns4erl.