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

How could I send multiple push notifications ? #95

Closed Wanty closed 9 years ago

Wanty commented 9 years ago

Hello,

I have a function (sendPushNotifications) in my controller which send multiple push notifications and then return a Response object.

Kind regards, Wanty

richsage commented 9 years ago

One way would be to register an event listener on the kernel.terminate event, and send your notifications there (since this event is triggered when the kernel is shutting down, after a response has been sent).

You could also shift these notifications into some kind of process queue and handle them in the background (cron task, queue eg rabbitmq and similar).

There are a few options :-)

Wanty commented 9 years ago

Hello @richsage, Thank you for your comment.

I would like to register an event listener on the kernel.terminate event (as you said before) for the following function "public function sendPushNotificationsAction() { ... return new Response() }" : how should I proceed ?

Thank you in advance, Wanty

richsage commented 9 years ago

You might want to take a look at the Symfony docs for the kernel.terminate event