Please check that you have installed and enabled these PHP extensions :
[x] gmp
[x] mbstring
[x] curl
[x] openssl
Please select any browsers that you are experiencing problems with:
[ ] Chrome
[ ] Firefox
[ ] Firefox for Mobile
[ ] Opera for Android
[ ] Samsung Internet Browser
[x] Other
Microsoft Edge
Problem
Although the output from $webPush->sendOneNotification($subscription, $payload); is a success, the notification is never received in Microsoft Edge. It works great though with Firefox & Chrome!
Expected
I expect to receive a browser notification in Microsoft Edge.
Features Used
[x] VAPID Support
[x] Sending with Payload
Example / Reproduce Case
First of all, I ask for browser notifications & register the service worker in JS:
navigator.serviceWorker.register('/sw.js');
navigator.serviceWorker.ready.then(function(registration)
{
var publicKey = urlB64ToUint8Array(getVAPIDPublicKey());
registration.pushManager.subscribe(
{
userVisibleOnly: true,
applicationServerKey: publicKey
}).then(function(subscription)
{
var data = JSON.stringify(subscription);
console.log(data);
}).catch(function(err)
{
console.log('Error: ', err);
});
});
With the result of the variable data, I use it to send a browser notification in PHP with web-push library.
// $data holds the value returned from console.log(data)
$subscription = \Minishlink\WebPush\Subscription::create(json_decode($data, true));
$auth =
[
'VAPID' =>
[
'subject' => 'myemail@myemail.com',
'publicKey' => '....',
'privateKey' => '....'
]
];
$webPush = new \Minishlink\WebPush\WebPush($auth);
$payload =
[
'title' => 'The title',
'body' => 'The body',
'icon' => '...',
'data' =>
[
'url' => '...',
]
];
$payload = json_encode($payload);
$report = $webPush->sendOneNotification($subscription, $payload);
$endpoint = $report->getRequest()->getUri()->__toString();
if ($report->isSuccess())
echo "[v] Message sent successfully for subscription {$endpoint}.";
else
echo "[x] Message failed to sent for subscription {$endpoint}: {$report->getReason()}";
Well, it seems it's a version problem. I'm using the version Microsoft Edge 44.18362.449.0 and I just tried with a recent version 87.0.664.66 and it worked great!
Setup
Please check that you have installed and enabled these PHP extensions :
Please select any browsers that you are experiencing problems with:
Microsoft Edge
Problem
Although the output from
$webPush->sendOneNotification($subscription, $payload);
is a success, the notification is never received in Microsoft Edge. It works great though with Firefox & Chrome!Expected
I expect to receive a browser notification in Microsoft Edge.
Features Used
Example / Reproduce Case
First of all, I ask for browser notifications & register the service worker in JS:
With the result of the variable
data
, I use it to send a browser notification in PHP with web-push library.The output is the expected:
But unfortunately Edge browser does not receive any notification!