Can't send the pushnotification for iOS
opened this issue · comments
I've used this for push notification in my project.
it works for Android.
But it doesn't work for iOS
I've got this error when I try to send push notification.
ErrorException: fwrite(): send of 253 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.
in file E:\xampp\htdocs\playdate\vendor\edujugon\push-notification\src\Apn.php on line 314
Stack trace:
1. ErrorException->() E:\xampp\htdocs\playdate\vendor\edujugon\push-notification\src\Apn.php:314
2. fwrite() E:\xampp\htdocs\playdate\vendor\edujugon\push-notification\src\Apn.php:314
3. Edujugon\PushNotification\Apn->send() E:\xampp\htdocs\playdate\vendor\edujugon\push-notification\src\PushNotification.php:163
4. Edujugon\PushNotification\PushNotification->send() E:\xampp\htdocs\playdate\app\Http\Controllers\ApiController.php:1865
5. App\Http\Controllers\ApiController->send_notification_apple() E:\xampp\htdocs\playdate\app\Http\Controllers\ApiController.php:1774
6. App\Http\Controllers\ApiController->send_notification() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Controller.php:54
7. call_user_func_array() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Controller.php:54
8. Illuminate\Routing\Controller->callAction() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php:45
9. Illuminate\Routing\ControllerDispatcher->dispatch() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Route.php:212
10. Illuminate\Routing\Route->runController() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Route.php:169
11. Illuminate\Routing\Route->run() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Router.php:658
12. Illuminate\Routing\Router->Illuminate\Routing\{closure}() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:30
13. Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php:41
14. Illuminate\Routing\Middleware\SubstituteBindings->handle() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
15. Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() E:\xampp\htdocs\playdate\vendor\laravel\framework\src\Ill...
This is my config file
'apn' => [
'certificate' => DIR . '/iosCertificates/DevMPD.pem',
'passPhrase' => '@love@', //Optional
'passFile' => DIR . '/iosCertificates/DevMPD.pem', //Optional
'dry_run' => true
]
This is my function for sending pushnotification
$push = new PushNotification('apn');
$extraNotificationData = ["message" => $msg, "user_name" =>$own_name, "user_id"=>$own_id];
$push->setMessage([
'aps' => [
'alert' => [
'title' => 'Development Push',
'body' => 'This is the testing for PRINCE'
],
'sound' => 'default',
'badge' => 1
],
'extraPayLoad' => [
'custom' => $extraNotificationData,
]
])
->setDevicesToken(['c0223b2a800ff6e975e3eef9ac6a484929d7e8ee05610a816b05910b20f0467b']);
$push->send();
Please help me now.
Thanks