rs / pushd

Blazing fast multi-protocol mobile and web push notification service
MIT License
1.16k stars 224 forks source link

Multiple APNS certificates #113

Open pmbnecc opened 9 years ago

pmbnecc commented 9 years ago

I have multiple iPhone apps that will use my PUSHd. It appears that I need an individual APNs certificate from Apple for each of these apps. Is there a way for the coffee.settings to be able to handle multiple APNs certificates?

deweweire commented 9 years ago

on my server, it's works .I just create multiple instance on pushd(don't forget to change the port or you'll have conflict ) .if you have some trouble you can send me an email via julien.deweweire@gmail.com

pmbnecc commented 9 years ago

Thanks. I am aware of that possibility, but I may have thousands of individual apps.

deweweire commented 9 years ago

i didn't find yet another solution .If i find it i'll share to you :) Do the same if you can :)

pmbnecc commented 9 years ago

I may have found my answer: In the settings.coffee file, I can add another exports['apns1'] and change the cert: and key: for the new app. Then, in the app itself, it can reference 'apns1' instead of 'apns' when communicating with the pushd server. I will try this at home tonight...

deweweire commented 9 years ago

i'll check tomorrow also .Keep me up to date and i do the same ;)

deweweire commented 9 years ago

i hope that they will be no trouble with the redis database

pmbnecc commented 9 years ago

Why I think it will work: We can have 'apns' and 'apns-dev' in settings.coffee. There is nothing magical in those names.

Why do you think that there might be trouble in the redis database?

deweweire commented 9 years ago

yes you're right never mind

pmbnecc commented 9 years ago

I renamed my main apns entry in settings.coffee, and my main app still works. Tomorrow I will get the new certificate and new app running, modifying settings.coffee to take the new certificate for the new app.

pmbnecc commented 9 years ago

I modified settings.coffee with the new information, and the new certificate for the new app, and it worked as expected!

tmnuwan12 commented 8 years ago

I am also running multiple instances. But just wondering how can you have multiple exports [apns] & [apns1] and refer to them from the app?

deweweire commented 8 years ago

If my memories are good, it's when you try to register and you said it's apns1 or apns

tmnuwan12 commented 8 years ago

You mean for proto="apns1" or proto="apns2" when you subscribe? Thanks.

deweweire commented 8 years ago

long time i didn't configure it but i think yes ^^

fabiosoft commented 7 years ago

You can export another setting in coffe file like this:

.
.
.

exports['apns'] =
    enabled: yes
    class: require('./lib/pushservices/apns').PushServiceAPNS
    # Convert cert.cer and key.p12 using:
    # $ openssl x509 -in cert.cer -inform DER -outform PEM -out apns-cert.pem
    # $ openssl pkcs12 -in key.p12 -out apns-key.pem -nodes
    cert: 'apns-cert.pem'
    key: 'apns-key.pem'
    cacheLength: 100
    # Uncomment to set the default value for parameter.
    # This setting not overrides the value for the parameter that is set in the payload fot event request.
    # category: 'show'
    # contentAvailable: true
    # Selects data keys which are allowed to be sent with the notification
    # Keep in mind that APNS limits notification payload size to 256 bytes
    payloadFilter: ['messageFrom']
    # uncommant for dev env
    gateway: 'gateway.sandbox.push.apple.com'
    address: 'feedback.sandbox.push.apple.com'

exports['apns-alt'] =
    enabled: yes
    class: require('./lib/pushservices/apns').PushServiceAPNS
    # Convert cert.cer and key.p12 using:
    # $ openssl x509 -in cert.cer -inform DER -outform PEM -out apns-cert.pem
    # $ openssl pkcs12 -in key.p12 -out apns-key.pem -nodes
    cert: 'apns-cert-alt.pem'
    key: 'apns-key-alt.pem'
    cacheLength: 100
    # Uncomment to set the default value for parameter.
    # This setting not overrides the value for the parameter that is set in the payload fot event request.
    # category: 'show'
    # contentAvailable: true
    # Selects data keys which are allowed to be sent with the notification
    # Keep in mind that APNS limits notification payload size to 256 bytes
    payloadFilter: ['messageFrom']
    # uncommant for dev env
    gateway: 'gateway.sandbox.push.apple.com'
    address: 'feedback.sandbox.push.apple.com'

.
.
.

just don't forget to change proto key in /subscribers request according the name you decided... probably a good practice is to use your app identifier.