Suljettu

Mobile APP push notification sending one by one and it's slow

Hello,

* in your description, and after reviewing the small code below, share a relevant description on how you intend to fix the issue. ( for project within the budget I provide extra $20 bonus if the issue is fixed)

The code below is responsible for sending notification to users, we noticed only when we got 3000 users, that the code is taking more than 70 seconds to leave our backend and start sending to users, and this is a long time. My requirements is to send in max (5sec) and it's doable as many other apps send to millions in seconds.

As you can see, my previous dev. create the array to send one by one. maybe theres a way to send them once. to get the budget+bonus the code should be tested in real time.

$db->setQuery($query);

$alertlists =$db->LoadObjectList();

//echo "<pre>";

//print_r($alertlists);exit;

foreach($alertlists AS $alertlist){

if($alertlist->isnotification == '1')

{

// for android

if($alertlist->device_type== "Android")

{

$notificationdata = array(

'registration_ids' => array($alertlist->gcm_regid),

'data' => array("message" => strip_tags($alertlist->video_des),

"video_id"=>$alertlist->id,

"device_token"=>$alertlist->device_id,

"device_type"=>$alertlist->device_type,

"userid"=>$alertlist->user_id,

"isnotification"=>$alertlist->isnotification,

"issound"=>$alertlist->issound,

"gonotification"=>'NO'),

);

$api_key = "AIzaSyBNxHKFlEhiJYYiT31Iz9dVXuYyeZps";

$headers = array(

'Authorization: key='.$api_key,'Content-Type: application/json'

);

$url = '[login to view URL]';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(($notificationdata)));

$result = curl_exec($ch);

// print_r($result);

curl_close($ch);

}

else

{

//IOS

$notificationdata = array();

$notificationdata['device_token'] = $alertlist->device_id;

$notificationdata['device_type'] = $alertlist->device_type;

$notificationdata['message'] = @strip_tags($alertlist->video_des);

$notificationdata['video_id']=$alertlist->id;

$notificationdata['userid'] = $alertlist->user_id;

$notificationdata['isnotification'] = $alertlist->isnotification;

$notificationdata['issound'] = $alertlist->issound;

$notificationdata['gonotification'] = 'NO';

$checkalertflag = JGFields::sendpushnotification($notificationdata);

}

}

}

return true;

Taidot: Android, iPhone, PHP

Näytä lisää: php and mobile dev, how to get ios apps on android, how to get apps on android, how to create a mobile app, android app push notification commercial, mobile web app push notification, iphone push notification app android, push notification app android phonegap, mobile app push notification, push notification services jquery mobile web app, build mobile app push notification server, custom push notification app, android sip app windows mobile, app push notification

Tietoa työnantajasta:
( 150 arvostelua ) Ramallah, Palestinian Territory

Projektin tunnus: #9727257

2 freelancers are bidding on average $71 for this job

pkpdeveloper

hii i can fix [login to view URL] start soon_______________________________________________________________________________________________________________________

$30 USD 0 päivässä
(76 arvostelua)
6.2
venomdev

Hi, I'm offering a bid if you can't find a solution with another developer. I have a few ideas to reduce both the looping and maybe the messages send but I would need time to test it before I would say it's a worki Lisää

$111 USD 4 päivässä
(7 arvostelua)
4.3