Closed Jonathan-Gander closed 9 years ago
@richsage will you merge this pull request?
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.
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.
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!
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.
Ah sorry - still early here, I hadn't read things properly :-) Now I understand! OK, great thanks - happy to merge :-)
Yeah great ! Thank you.
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 bystream_context_set_option
to set streamlocal_cert
option.Note that
onKernelTerminate
method intoAppleNotification
will also close all streams.