Comments (26)
Hi,
I am still facing the issue but, that is because the APN ports are blocked on my server. It is not a package issue.
Thanks for all your support and help !
Much Appreciated !
from pushnotification.
Thanks for your support, and sorry for such a thing..Everything went well.
from pushnotification.
Hi,
This issue is because the app is not finding the apn certificate.
Could you show me an screenshot of your config file and another screenshot of your folders tree?
from pushnotification.
Hi,
PFA the required screenshots
Please let me know if you need more details on the same.
Thanks !
from pushnotification.
I see the problem. You are using the package folder and config file to store and set the certificate details.
Instead of that. You have to use your application config folder.
Do you have a pushnotification.php file under your app config folder?
And, do you have a iosCertificates folder under your app config folder?
from pushnotification.
Hi,
Thanks ! That solved the issue for me. But, I got a new error.
ErrorException in Apn.php line 184:
stream_socket_client(): unable to connect to ssl://gateway.push.apple.com:2195 (Connection refused)
from pushnotification.
That issue is because your app can't open a socket with the apn server.
Have you used any passphrase when created the certificate? If so, have you put that passPhrase in your config file?
Maybe you could create certificate with mini character passphrase like 1234
Have a try and let me know.
from pushnotification.
I am using the passphrase in the config file. I have commented the passfile. Is that required ?
from pushnotification.
No, it's not required :)
from pushnotification.
Hi @svs22121990,
Just wondering if you could solve the issue.
I'm about to close this issue since it's not a package issue.
from pushnotification.
Hi, I encountered the same issue.
Could you give me some help?
・I configured some certificates and everything went well in Laravel 5.4 on my Mac.
・But I uploaded it to AWS via Elastic BeanStalk, nothing done even if I entered some code.
・All Certificaties uploaded successfully. I confirmed previlliges and it seems no error.
[ec2-user@i(myip) config]$ ls -al 合計 128 drwxr-xr-x 3 webapp webapp 4096 3月 3 11:04 . drwxrwxr-x 14 webapp webapp 4096 3月 3 11:05 .. -rw-r--r-- 1 webapp webapp 10762 3月 3 11:04 app.php -rw-r--r-- 1 webapp webapp 3275 3月 3 11:04 auth.php -rw-r--r-- 1 webapp webapp 1530 3月 3 11:04 broadcasting.php -rw-r--r-- 1 webapp webapp 2598 3月 3 11:04 cache.php -rw-r--r-- 1 webapp webapp 517 3月 3 11:04 cors.php -rw-r--r-- 1 webapp webapp 3951 3月 3 11:04 database.php -rw-r--r-- 1 webapp webapp 24141 3月 3 11:04 excel.php -rw-r--r-- 1 webapp webapp 2064 3月 3 11:04 filesystems.php -rw-r--r-- 1 webapp webapp 508 3月 3 11:04 image.php drwxr-xr-x 2 webapp webapp 4096 3月 3 11:04 iosCertificates -rw-r--r-- 1 webapp webapp 5306 3月 3 11:04 jwt.php -rw-r--r-- 1 webapp webapp 4216 3月 3 11:04 mail.php -rw-r--r-- 1 webapp webapp 4243 3月 3 11:04 pushios.pem -rw-r--r-- 1 webapp webapp 0 3月 3 11:04 pushios2.pem -rw-r--r-- 1 webapp webapp 601 3月 3 11:04 pushnotification.php -rw-r--r-- 1 webapp webapp 2481 3月 3 11:04 queue.php -rw-r--r-- 1 webapp webapp 980 3月 3 11:04 services.php -rw-r--r-- 1 webapp webapp 6270 3月 3 11:04 session.php -rw-r--r-- 1 webapp webapp 1004 3月 3 11:04 view.php -rw-r--r-- 1 webapp webapp 88 3月 3 11:04 workflow.php [ec2-user@ip-(myip) config]$ cd iosCertificates/ [ec2-user@ip-(myip) iosCertificates]$ ls -al 合計 24 drwxr-xr-x 2 webapp webapp 4096 3月 3 11:04 . drwxr-xr-x 3 webapp webapp 4096 3月 3 11:04 .. -rw-r--r-- 1 webapp webapp 0 3月 3 11:04 .gitkeep -rw-r--r-- 1 webapp webapp 1671 3月 3 11:04 PushCert_key_nokey.pem -rw-r--r-- 1 webapp webapp 2574 3月 3 11:04 pushCertDocu.pem -rw-r--r-- 1 webapp webapp 4421 3月 3 11:04 pushios3.pem
from pushnotification.
Hi @deruta1992 ,
What's the exact error you get when trying to send a notification?
from pushnotification.
the error was like below:
object(stdClass)#1014(2){
["success"]=>bool(false)
["error"]=>
string(64) "Please, add your APN certificate to the iosCertificates folder.
"
}
from pushnotification.
Could you review your path to your ios certificate? Make sure that it's case sensitive
from pushnotification.
I didn't change it.
[ 'priority' => 'normal', 'dry_run' => false, 'apiKey' => 'My_ApiKey', ], 'fcm' => [ 'priority' => 'normal', 'dry_run' => false, 'apiKey' => 'My_ApiKey', ], 'apn' => [ 'passPhrase' => '(mypass)', //Optional 'passFile' => __DIR__ . '/iosCertificates/PushCert_key_nokey.pem', //Optional 'connection_attempts' => 0, 'dry_run' => false ] ];from pushnotification.
Could you try the following:
$push = new PushNotification('apn');
var_dump($push);
Have a look at the output. check the $config
property of the object and make sure that the certificate
array key is pointing to your certificate location.
from pushnotification.
I cahnged config and result is as below:
object(Edujugon\PushNotification\PushNotification)#972 (5) {
["service":protected]=>
object(Edujugon\PushNotification\Apn)#973 (10) {
["sandboxUrl":"Edujugon\PushNotification\Apn":private]=>
string(41) "ssl://gateway.sandbox.push.apple.com:2195"
["productionUrl":"Edujugon\PushNotification\Apn":private]=>
string(33) "ssl://gateway.push.apple.com:2195"
["feedbackSandboxUrl":"Edujugon\PushNotification\Apn":private]=>
string(42) "ssl://feedback.sandbox.push.apple.com:2196"
["feedbackProductionUrl":"Edujugon\PushNotification\Apn":private]=>
string(34) "ssl://feedback.push.apple.com:2196"
["feedbackUrl":"Edujugon\PushNotification\Apn":private]=>
string(34) "ssl://feedback.push.apple.com:2196"
["maxAttempts":"Edujugon\PushNotification\Apn":private]=>
int(3)
["attempts":"Edujugon\PushNotification\Apn":private]=>
int(0)
["url":protected]=>
string(33) "ssl://gateway.push.apple.com:2195"
["config":protected]=>
array(4) {
["passPhrase"]=>
string(9) "(maskedkey)"
["passFile"]=>
string(62) "/var/app/current/config/iosCertificates/PushCert_key_nokey.pem"
["connection_attempts"]=>
int(0)
["dry_run"]=>
bool(false)
}
["feedback":protected]=>
NULL
}
["servicesList":protected]=>
array(3) {
["gcm"]=>
string(29) "Edujugon\PushNotification\Gcm"
["apn"]=>
string(29) "Edujugon\PushNotification\Apn"
["fcm"]=>
string(29) "Edujugon\PushNotification\Fcm"
}
["defaultServiceName":"Edujugon\PushNotification\PushNotification":private]=>
string(3) "gcm"
["deviceTokens":protected]=>
array(0) {
}
["message":protected]=>
array(0) {
}
}
object(stdClass)#974 (2) {
["success"]=>
bool(false)
["error"]=>
string(64) "Please, add your APN certificate to the iosCertificates folder.
"
}
from pushnotification.
Hi @deruta1992 ,
I see that you are missing the certificate key in your apn configuration.
Replace passFile
with certificate
and try again
from pushnotification.
Nothing changed... I added Certificates, that was the problem in my git, and run well in local. Still not work in the Server.
from pushnotification.
I attached the log file on my PC.
from pushnotification.
if you test the following what do you get?
dd(file_exists('HERE-THE-PATH-TO-YOUR-CERTIFICATE'));
from pushnotification.
The result was link above. I run the command in Kernel/Command:
$this->info(dd(file_exists('/var/www/html/config/iosCertificates/PushCertDocu.pem')));
from pushnotification.
Hi @deruta1992 ,
I think I saw the issue. And actually it's related to my very first comment to you.
It's related to case sensitive. I see that the pushCertDocu file starts with lowercase but in code you have it capital letter...
Please be sure that in both side are case sensitive and try again.. It should fix the issue..
try again with this:
$this->info(dd(file_exists('/var/www/html/config/iosCertificates/pushCertDocu.pem')));
That should return TRUE.
from pushnotification.
i am facing the same issue
while i am doing the $push = new PushNotification('apn');
var_dump($push);
i got this
object(Edujugon\PushNotification\PushNotification)#485 (5) {
["service":protected]=>
object(Edujugon\PushNotification\Apn)#486 (10) {
["sandboxUrl":"Edujugon\PushNotification\Apn":private]=>
string(41) "ssl://gateway.sandbox.push.apple.com:2195"
["productionUrl":"Edujugon\PushNotification\Apn":private]=>
string(33) "ssl://gateway.push.apple.com:2195"
["feedbackSandboxUrl":"Edujugon\PushNotification\Apn":private]=>
string(42) "ssl://feedback.sandbox.push.apple.com:2196"
["feedbackProductionUrl":"Edujugon\PushNotification\Apn":private]=>
string(34) "ssl://feedback.push.apple.com:2196"
["feedbackUrl":"Edujugon\PushNotification\Apn":private]=>
string(42) "ssl://feedback.sandbox.push.apple.com:2196"
["maxAttempts":"Edujugon\PushNotification\Apn":private]=>
int(3)
["attempts":"Edujugon\PushNotification\Apn":private]=>
int(0)
["url":protected]=>
string(41) "ssl://gateway.sandbox.push.apple.com:2195"
["config":protected]=>
array(4) {
["certificate"]=>
string(74) "/home/eshopper/public_html/config/iosCertificates/eshoppers_production.pem"
["passPhrase"]=>
string(12) "MyPassPhrase"
["passFile"]=>
string(61) "/home/eshopper/public_html/config/iosCertificates/yourKey.pem"
["dry_run"]=>
bool(true)
}
["feedback":protected]=>
NULL
}
["servicesList":protected]=>
array(3) {
["gcm"]=>
string(29) "Edujugon\PushNotification\Gcm"
["apn"]=>
string(29) "Edujugon\PushNotification\Apn"
["fcm"]=>
string(29) "Edujugon\PushNotification\Fcm"
}
["defaultServiceName":"Edujugon\PushNotification\PushNotification":private]=>
string(3) "gcm"
["deviceTokens":protected]=>
array(0) {
}
["message":protected]=>
array(0) {
}
}
in my controller
use Edujugon\PushNotification\PushNotification;
public function add_product_notification(Request $request){
try {
$get_notification = Notification::where('is_send',0)->orderBy('id','ASC')->get();
foreach ($get_notification as $values){
$user = User::where ('status','active')->get();
foreach ($user as $key => $value){
$deviceid = $value['deviceToken'];
$push = new PushNotification('apn');
/*IOS notification*/
$push->setMessage([
'aps' => [
'alert' => [
'title' => 'Eshoppers',
'body' => $values['message']
],
'sound' => 'default',
'badge' => 1
],
'extraPayLoad' => [
'custom' => 'My custom data',
]
])
->setDevicesToken($deviceid)
->send()->getFeedback();
dd($push->getFeedback());
}
}
} catch (Exception $e) {
return response("", 500);
}
}
from pushnotification.
return [
'gcm' => [
'priority' => 'normal',
'dry_run' => false,
'apiKey' => 'My_ApiKey',
],
'fcm' => [
'priority' => 'normal',
'dry_run' => false,
'apiKey' => 'AIzaSyA_yPGH_cNAkT3goJMggE_aYhETzDTU9FU',//legasy server key
],
'apn' => [
'certificate' =>config_path().'/iosCertificates/eshoppers_production.pem',
'passPhrase' => 'MyPassPhrase', //Optional
'passFile' => DIR . '/iosCertificates/yourKey.pem', //Optional
'dry_run' => true
]
from pushnotification.
public function add_product_notification(Request $request){
try {
$get_notification = Notification::where('is_send',0)->orderBy('id','ASC')->get();
foreach ($get_notification as $values){
$user = User::where ('status','active')->get();
foreach ($user as $key => $value){
$deviceid = $value['deviceToken'];
$push = new PushNotification('apn');
echo'<pre>';
var_dump($push);
echo'</pre>';
/*IOS notification*/
$push->setMessage([
'aps' => [
'alert' => [
'title' => 'Eshoppers',
'body' => $values['message']
],
'sound' => 'default',
'badge' => 1
],
'extraPayLoad' => [
'custom' => 'My custom data',
]
])
->setDevicesToken($deviceid)
->send()->getFeedback();
dd($push->getFeedback());
/*$deviceid = $value['deviceToken'];
$device_char = strlen($value['deviceToken']);
if ($value['deviceToken']!="" && $device_char >=20 ) {
\Davibennun\LaravelPushNotification\Facades\PushNotification::app('appNameIOS')
->to($deviceid)
->send($values['message'])->getFeedback();
}*/
}
/* $get_notification_by_id = Notification::findOrFail($values['id']);
$inp['is_send'] = 1;
$get_notification_by_id->update($inp);*/
}
} catch (Exception $e) {
return response("", 500);
}
}
from pushnotification.
Related Issues (20)
- Unable to send notifications via FCM.
- Content-Type:" is not valid header name HOT 6
- Document breaking change in v4.5.1?
- [L 6.0]Testing push notification
- Breaking change in 4.5.1: Undefined index: headers HOT 2
- loc-key and loc-args on the payload
- Undefined index: headers HOT 7
- Need support of Voip
- Badge count not working with fcm
- Push notiication not working on Ios
- update to newer versions
- notifications not sendings HOT 2
- Installation issue with laravle9.2 HOT 4
- Issue in Laravel 9.2 HOT 7
- FCM Api Key HOT 2
- add support for huawei
- cannot send push notifications(ios, android)
- Error al crear $push = new PushNotification
- MissingTopic HOT 1
- Migrating from legacy FCM to HTTP v1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pushnotification.