web-push-php: Sending with payload not working
NOTE: Please test in a least two browsers (i.e. Chrome and Firefox). This helps with diagnosing problems quicker.
Please confirm the following:
- I have read the README entirely
- I have verified in the issues that my problem hasn’t already been resolved
Setup
Please provide the following details, the more info you can provide the better.
- Operating System: Windows
- PHP Version: 7.1.5
- web-push-php Version: v3.0.0
Please check that you have installed and enabled these PHP extensions :
- gmp
- mbstring
- curl
- openssl
Please select any browsers that you are experiencing problems with:
- Chrome
- Firefox
- Firefox for Mobile
- Opera for Android
- Samsung Internet Browser
- Other
Please specify the versions (i.e. Chrome Beta, Firefox Beta etc). Chrome 64
Problem
I am unable to send notifications with payloads. Each time the payload is not empty, the request is sent and sendNotification method returns true (when I dumped response, status code was 201), but no notification is delivered.
Disabling the padding did not help.
I am suspecting the encryption/signing not working correctly and I will be trying to debug it step by step against web-push for node.js, which works OK.
Please explain what behaviour you are seeing.
Expected
Send notification with payload, that is delivered to the browser.
Please explain what you expected to happen
Features Used
- VAPID Support
- GCM API Key
- Sending with Payload
Example / Reproduce Case
$subscription = '{"endpoint":"https://fcm.googleapis.com/fcm/send/fxfsxX_N7Is:APA91bFeXNv4zQ9xKl2k-rfmf5zweDJP3walARMXnQFa6pdx4_1OCldKjl1ruuKPavs67tK5_xfP3XMx2XRVRWTIrhIaS6_GIQvT4U9hmH3xDJBABVfNlBewnx0Zml6oFZKiEW9xmZ5-","expirationTime":null,"keys":{"p256dh":"BHs7fMO97vNgGePrFBCdtK4cwCirLiL56e34QqpoirN5_MC2-LgoTsJ5hV0vu6wn7oRpebgYelICX7bEvXbB7mI=","auth":"aZ5dQkxnt7yFsdV4dpZS3w=="}}';
$subscription = json_decode($subscription, true);
use Minishlink\WebPush\WebPush;
$auth = [
'VAPID' => [
'subject' => 'mailto:my@email.cz',
'publicKey' => 'BDaIDoGypt1kzw1XkCItDuvH0iKb9NcsiXjltGt1rCOXy7vF2ER94UqNM-Ers0ey8FzK6bskzPpXKwwYo0LgCBA',
'privateKey' => '-n1Xh2Zrpl3GeV50X5vBtSHFzwbDs5Ie0LMzkfsyjLs',
],
];
$webPush = new WebPush($auth);
$webPush->sendNotification(
$subscription['endpoint'],
'Hello data',
$subscription['keys']['p256dh'],
$subscription['keys']['auth'],
true
);
Please provide a code sample that reproduces the issue. If there is a repository that reproduces the issue please put the link here.
Other
Please put any remaining notes here.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (9 by maintainers)
@Minishlink, maybe it will be useful: When testing version 3.0 received an exception