Hi i am not a big expert of Server side. I have written a long web service function which does a number of queries and processes and usually sometimes it send push notifications at the end of function to 1-20 iPhone users.
Now while writing sending massive scale push notifications to iPhone users, u have to put a delay of 1 second in between each push. This will make the simple api query takes so long like 30 seconds.
I want to avoid this , is there any way when i call web api, it runs all code and start a new thread or a page inside server and send push notifications without stalling original api and send data back to the mobile app meanwhile running a function separately on server to send push notifications.
We don't want to use any cron jobs also the web api is calculating list of users so push function can only be called inside.
$this->sendPushNotification($friendsList, $userId);
$response = array(
'error'=>false,
'invalidKey'=>false,
'message'=>"Your query has completed"
);
$this->jsonOutput($response);
Now i want to send jsonOutput at soon as the query is complete without waiting for sendPushNotification to compelte. Simply put i want to run the function asynchronously in php .