@@ -27,15 +27,18 @@ $notifications = array(
27
27
array(
28
28
'endpoint' => 'https://updates.push.services.mozilla.com/push/abc...', // Firefox 43+
29
29
'payload' => 'hello !',
30
- 'userPublicKey' => 'dahaj5365sq',
30
+ 'userPublicKey' => 'BPcMbnWQL5GOYX/5LKZXT6sLmHiMsJSiEvIFvfcDvX7IZ9qqtq68onpTPEYmyxSQNiH7UD/98AUcQ12kBoxz/0s=', // base 64 encoded, should be 88 chars
31
+ 'userAuthToken' => 'RMpCEzkgBaVj0Zj0', // base 64 encoded, should be 16 chars
31
32
), array(
32
33
'endpoint' => 'https://android.googleapis.com/gcm/send/abcdef...', // Chrome
33
34
'payload' => null,
34
35
'userPublicKey' => null,
36
+ 'userAuthToken' => null,
35
37
), array(
36
38
'endpoint' => 'https://example.com/other/endpoint/of/another/vendor/abcdef...',
37
39
'payload' => '{"msg":"test"}',
38
- 'userPublicKey' => 'fsqdjknadsanlk',
40
+ 'userPublicKey' => '(stringOf88Chars)',
41
+ 'userAuthToken' => '(stringOf16Chars)',
39
42
),
40
43
);
41
44
@@ -46,7 +49,8 @@ foreach ($notifications as $notification) {
46
49
$webPush->sendNotification(
47
50
$notification['endpoint'],
48
51
$notification['payload'], // optional (defaults null)
49
- $notification['userPublicKey'] // optional (defaults null)
52
+ $notification['userPublicKey'], // optional (defaults null)
53
+ $notification['userAuthToken'] // optional (defaults null)
50
54
);
51
55
}
52
56
$webPush->flush();
@@ -56,6 +60,7 @@ $webPush->sendNotification(
56
60
$notifications[0]['endpoint'],
57
61
$notifications[0]['payload'], // optional (defaults null)
58
62
$notifications[0]['userPublicKey'], // optional (defaults null)
63
+ $notifications[0]['userAuthToken'], // optional (defaults null)
59
64
true // optional (defaults false)
60
65
);
61
66
```
@@ -78,7 +83,7 @@ $apiKeys = array(
78
83
);
79
84
80
85
$webPush = new WebPush($apiKeys);
81
- $webPush->sendNotification($endpoint, null, null, true);
86
+ $webPush->sendNotification($endpoint, null, null, null, true);
82
87
```
83
88
84
89
### Payload length and security
0 commit comments