function send($title,$message,$type,$token,$device_id) {
$data = array('to' => '/topics/'.$device_id , 'content_available' => true , 'data' => array( 'type' => $type));
$api = 'AAAAn';
$res2 = $this->me->db->where('sDeviceID',$device_id)->select('sToken')->get('tokens');
if ($res2->num_rows() == 1) {
$data['to'] = $res2->row()->sToken;
}
ob_start();
$curl = curl_init('https://fcm.googleapis.com/fcm/send');
curl_setopt($curl, CURLOPT_POST,1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,FALSE);
curl_setopt($curl, CURLOPT_POSTFIELDS,json_encode($data));
curl_setopt($curl, CURLOPT_HTTPHEADER,array('Content-type:application/json;charset=UTF-8','Authorization:key='.$api));
curl_exec($curl);
curl_close($curl);
$res = ob_get_clean();
return $res;
}