Closed Wanty closed 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 :-)
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
You might want to take a look at the Symfony docs for the kernel.terminate event
Hello,
I have a function (sendPushNotifications) in my controller which send multiple push notifications and then return a Response object.
Kind regards, Wanty