Open codepushr opened 8 years ago
I haven't used the feedback service yet, though I know it can take some time to get feedback.
Maybe @tylrtrmbl or @bdotdub can chime in.
There's a few things going on here.
...even if I test it with broken/custom device tokens
The Feedback service does not report missing / invalid / "broken" tokens. It only reports valid device tokens that belong to devices that have repeated reported failed delivery attempts. If you keep sending notifications to these offline devices, Apple may punish your provider; but there's nothing "expired" or "invalid" about tokens you receive from the feedback service.
I would love to detect expired tokens and delete them to keep my data clean and only send pushes to valid devices.
Yes, implement that! For testing, the usual way you trigger a removed token is to uninstall your development app from your test device. The token for that device will appear on the Sandbox APNS feedback channel. However, beware. The uninstall is only reported to APNS if you have another app using the Sandbox gateway on that same device. Otherwise, the OS simply abruptly closes its connection to Sandbox APNS and does not report the uninstall. Don't ask me why, Apple was simply very very simplistic with their implementation of all of APNS. :smile: To get around this, I made an app I called "SandAPNS" that registers for push notifications on the sandbox and does nothing else. I leave it installed on my phone.
Best of luck!
@tylrtrmbl Wow thanks for the insight! I will test it by removing my app and check if I get responses from the feedback channel. I didn't know I also need another app listening via APNS sandbox lol, good tip!
@nathany Thanks for tuning in!
@tylrtrmbl I just read the APNS documentation... So basically what I have to do is:
I just tried uninstalling my app and sending another push to it, afterwards I fetched the feedback service but nothing came. Does it take some time for APNS to add it into the feedback queue?
I'm looking forward for this whole feedback service mess to go away with #57. Whenever we can get some documentation from Apple.
Your steps are correct! It does take a while for APNS to put your token on the queue- and potentially maybe several "failed deliveries" if the documentation is to be believed.
My exhaustive list of things to double check:
And hopefully you see your token! I'm curious which steps of these are necessary- how long is it necessary to wait? Are sending failed messages required?
I too look forward to these questions getting cleared up with the HTTP/2 API. :smile:
@tylrtrmbl Thanks :smile: One last question: Do I need to recreate the Feedback "client" every time I want to Receive()
because what I'm doing with the regular APNS client is: I'm initialising it once and using it all the time. Right now I'm doing the same with the Feedback object but maybe it's not working the same way...
Ok I checked the code and figured it out :) Still no feedback though, if I find something I'll let you know, but for now I think all my questions are answered :)
I'd like to leave this open as documentation (or an issue that should be documented).
hi, I found this issue by searching apn's feedback problem. I had tested feedback service about 3 months ago with other apns library which works fine. But I did not do a production deploy. Today I am trying to do production deploy of feedback check. I found apple's feedback service would close the connection immediately. So I am wondering that was this be normal when no fail token at all? Since I have tried to send some msgs with uninstalled token, I don't think there would exist no fail token.. Thanks.
@Kinghack For me the feedback never worked in production with this library! I had tons of expired tokens but never got any feedback. I eventually moved to GCM which I use for both Android and iOS.
Apple has since changed their API to be based on HTTP/2 without the need for a feedback service.
You may want to check out one of these libraries:
@codepushr @nathany Ok. I will check the new APNS service. Thanks.
Hey guys, thanks for this awesome piece of work, this is definitely one of the best APNS packages out there for go.
I'm not really sure if I'm using the feedback service correctly because it sort of never prints any errors, even if I test it with broken/custom device tokens. I would love to detect expired tokens and delete them to keep my data clean and only send pushes to valid devices.
This is how I use it:
As mentioned above I tried to use random device tokens in the belief that it would print something, but nothing happens. I'm not even sure if I'm calling the feedback service correctly because the sending is asynchronous and maybe my feedback loop is called too early... if so, where and how should I call it?
Oh and, yes
n.apnsf
is correctly initialized and throws no errors. I just wanted to keep the code small.Thanks, codingrogue