Minishlink / web-push-bundle

Bundle around the WebPush library
MIT License
45 stars 10 forks source link

web push api issues in using wamp #6

Closed opensourcewebapplications closed 7 years ago

opensourcewebapplications commented 7 years ago

hi i am trying to use https://github.com/web-push-libs/web-push-php

there are issues in using on local server wamp

want to use this for send push notification

use Minishlink\WebPush\WebPush;

// array of notifications $notifications = array( array( 'endpoint' => 'https://updates.push.services.mozilla.com/push/abc...', // Firefox 43+ 'payload' => 'hello !', 'userPublicKey' => 'BPcMbnWQL5GOYX/5LKZXT6sLmHiMsJSiEvIFvfcDvX7IZ9qqtq68onpTPEYmyxSQNiH7UD/98AUcQ12kBoxz/0s=', // base 64 encoded, should be 88 chars 'userAuthToken' => 'CxVX6QsVToEGEcjfYPqXQw==', // base 64 encoded, should be 24 chars ), array( 'endpoint' => 'https://android.googleapis.com/gcm/send/abcdef...', // Chrome 'payload' => null, 'userPublicKey' => null, 'userAuthToken' => null, ), array( 'endpoint' => 'https://example.com/other/endpoint/of/another/vendor/abcdef...', 'payload' => '{msg:"test"}', 'userPublicKey' => '(stringOf88Chars)', 'userAuthToken' => '(stringOf24Chars)', ), );

$webPush = new WebPush();

// send multiple notifications with payload foreach ($notifications as $notification) { $webPush->sendNotification( $notification['endpoint'], $notification['payload'], // optional (defaults null) $notification['userPublicKey'], // optional (defaults null) $notification['userAuthToken'] // optional (defaults null) ); } $webPush->flush();

// send one notification and flush directly $webPush->sendNotification( $notifications[0]['endpoint'], $notifications[0]['payload'], // optional (defaults null) $notifications[0]['userPublicKey'], // optional (defaults null) $notifications[0]['userAuthToken'], // optional (defaults null) true // optional (defaults false) );

issues in using use Minishlink\WebPush\WebPush; and plz which url to use in endpoint ?

Minishlink commented 7 years ago

See web-push-php#69.