richsage / RMSPushNotificationsBundle

NOT MAINTAINED! ⛔️ Push notifications/messages for mobile devices. Supports iOS, Android (C2DM, GCM), Blackberry and Windows Mobile (toast only). A Symfony2 bundle.
MIT License
321 stars 152 forks source link

Multiple APNS certificates #93

Closed Jonathan-Gander closed 9 years ago

Jonathan-Gander commented 9 years ago

You can now use rmsPushNotificator->setAPNSPemAsString($pemContent, $passphrase) method to specify another certificate for Apple Push Notifications Service. It won't use pem specified in configuration anymore if you call this method.

AppleNotification class will write a pem file into cache and remove it on kernel terminate. It will be used by stream_context_set_option to set stream local_cert option.

Note that onKernelTerminate method into AppleNotification will also close all streams.

Kevinrob commented 9 years ago

@richsage will you merge this pull request?

richsage commented 9 years ago

I think I'd prefer this to be done as part of configuration to be honest - can you outline a use case for this where runtime is preferred over application configuration? See #76 for a configuration-style approach.

Jonathan-Gander commented 9 years ago

We prefer runtime configuration when you have to send push notifications to many mobile applications throw one Symfony website. Settings for each mobile app (like certificate) are stored into a database because they can change (modify, add/remove).
It's our case in our business Symfony web app.

richsage commented 9 years ago

ah, that's an interesting approach - thanks for clarifying :-) But in that case would it maybe be better sent as part of the notification model? I'm definitely interested in this though!

Jonathan-Gander commented 9 years ago

To use it you can just call setAPNSPemAsString of your Notifications service class.
I don't get exactly what you mean with "as part of the notification model" ? We've tried to modify the minimum the AppleNotification class to keep your code clear.

richsage commented 9 years ago

Ah sorry - still early here, I hadn't read things properly :-) Now I understand! OK, great thanks - happy to merge :-)

Jonathan-Gander commented 9 years ago

Yeah great ! Thank you.