dcai / airnotifier

Push Notifications Server for Human Beings.
Other
602 stars 190 forks source link

APNS connection is flakey #122

Closed pliablepixels closed 4 years ago

pliablepixels commented 8 years ago

I've been testing both GCM and APNS for a few days now. APNS uses sandbox. It seems after running the server for 15 minutes or so, messages to APNS don't get delivered. I see logs in air notifier that it is sending out to the token but it never reaches. The only solution is to restart APNS. Would you know why this is happening?

pliablepixels commented 8 years ago

I modified my fork to use pyAPNS for the send as well and its been very stable.

dcai commented 8 years ago

Hi @pliablepixels may I merge your changes? I'm going to take a look the bug over the weekend.

pliablepixels commented 8 years ago

hi @dcai first, thank you for this excellent solution. I was frustrated when I discovered you need to host your own server to do push for apps you create and then I found air notifier!

my changes are really a hack as I don't really know python. I've just been sticking code together in ugly ways.

I made the following changes:

a) the template html for tokens only allows 64 characters - GCM ids are much larger. I've styled the tokens page to it does a overflow scroll instead of cutting at 64

b) I'm incrementally replacing the apns code with pyAPNS because of feedback implementation as well as the stability problem I wrote above - but I did it in an ugly way so far - I renamed pyapns classes so it doesn't conflict with yours (added py in front) and it also supports newer payloads for APS (like larger payload etc) My thought was to get things working and then clean up :-)

c) I changed the feedback implementation to call pyAPNS feedback and have also added code to remove the tokens from the DB

d) I modified air notifier.py to start on SSL - I did not want to expose a HTTP API to my users

Please feel free to look over my forked repo and review my hacks and take what you'd like but I know its not done correctly.

I do have some feedback for your consideration:

In essence I am using air notifier as a hosted push proxy server for a popular home security solution called ZoneMinder. The app I am developing is here --> https://github.com/pliablepixels/zmNinja. I am using Airnotifier so that different people running their own instances of ZoneMinder can push notitications to my server and I push it on to devices.

Given this scenario, I am already managing over 10,000 notifications per day from different people and I haven't event released the app (its in beta). With that in mind:

a) Airnotifier was a boon for me - I did not want to spend time coding a server and your responsive UI based solution was fabulous and works well for the most part.

b) I'd love to see an option to run the APNS feedback at a configured interval automatically as a timer. Apple recommends it

c) An option to automatically purge logs (don't have to press a button) - but the .log/.err files as well as the DB of logs

d) Its very useful (and I'd say important) to please consider adding an IP address to your logs so people using the system can monitor source based traffic

I was planning to work on all of this and start learning python and bootstrap - eventually. Thanks for your consideration.

dcai commented 8 years ago

@pliablepixels pliablepixels Thanks so much for the changes and feedback :+1:

I have been busy during the week, but will definitely look into these issues this weekend :)

pliablepixels commented 8 years ago

hi @dcai - wanted to check if you would be releasing an updated version with some (or all :+1: ) of these features?

dcai commented 8 years ago

hi @pliablepixels These changes have already been added to 1.x branch, I bumped the version number accordingly: https://github.com/airnotifier/airnotifier/blob/1.x/constants.py#L29

I also created 2.x branch, I'm waiting new APNs available: https://developer.apple.com/videos/play/wwdc2015-720/, essentially it enables http/2 protocol for APNs, thus feedback service could be avoided as each notification request will get the feedback immediately.

pliablepixels commented 8 years ago

Hi @dcai that is great - I am looking through the changes - I think you are still in the process of implementing some - would it be alright if I broke up my mail above (points a-d) into separate issues? that way, I can also help and contribute over what you have done.

zympolium commented 7 years ago

Hi, I have the same problem : "It seems after running the server for 15 minutes or so, messages to APNS don't get delivered" Is there any evolution of APNS leading a stability problem or maybe this issue is just still open ? :)