manifestinteractive/easyapns — Issue #20: Usage with multiple apps
Author: DennisTT
Created: 2012-02-23 21:20:11+00:00
State: open

Hi there,

I am trying to use this to service multiple apps using the same server. I found in the code that the tables store the app name and version which would help me find the devices using the apps I want to target for a notification. Then reading the Issues here I also found clientId which I could use to categorize devices in the same way.

However, one thing that I can't seem to find addressed is how to use separate certificates for the different apps. If I understand correctly, each different App ID requires a different SSL certificate. I think if I separate the apns.php for my different apps, I can construct instances of the APNS class with different certificates, but the problem seems to be when I use the cronjob for fetching/pushing notifications, the fetchMessages will try to fetch all messages regardless of app or client ID and push with the certificates it has on hand, not necessarily the right ones.

The solution I'm thinking of is adding the client ID to the APNS constructor, then any device registering and any notification sent would use that client ID by default. I plan to offer this back as a pull request afterwards so I just wanted to see if this would be the preferred way of doing it, or if there's something I'm overlooking.