You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Time To Live (TTL, in seconds) is how long a push message is retained by the push service (eg. Mozilla) in case the user browser
112
116
is not yet accessible (eg. is not connected). You may want to use a very long time for important notifications. The default TTL is 4 weeks.
113
117
However, if you send multiple nonessential notifications, set a TTL of 0: the push notification will be delivered only
114
118
if the user is currently connected. For other cases, you should use a minimum of one day if your users have multiple time
115
119
zones, and if they don't several hours will suffice.
116
120
121
+
#### urgency
122
+
Urgency can be either "very-low", "low", "normal", or "high". If the browser vendor has implemented this feature, it will save battery life on mobile devices (cf. [protocol](https://tools.ietf.org/html/draft-ietf-webpush-protocol-08#section-5.3)).
123
+
124
+
#### topic
125
+
Similar to the old `collapse_key` on legacy GCM servers, this string will make the vendor show to the user only the last notification of this topic (cf. [protocol]((cf. [protocol](https://tools.ietf.org/html/draft-ietf-webpush-protocol-08#section-5.4)))).
126
+
127
+
### Payload length and security
128
+
Payload will be encrypted by the library. The maximum payload length is 4078 bytes (or ASCII characters).
129
+
130
+
However, when you encrypt a string of a certain length, the resulting string will always have the same length,
131
+
no matter how many times you encrypt the initial string. This can make attackers guess the content of the payload.
132
+
In order to circumvent this, this library can add some null padding to the initial payload, so that all the input of the encryption process
133
+
will have the same length. This way, all the output of the encryption process will also have the same length and attackers won't be able to
134
+
guess the content of your payload. The downside of this approach is that you will use more bandwidth than if you didn't pad the string.
135
+
That's why the library provides the option to disable this security measure:
136
+
117
137
```php
118
138
<?php
119
139
120
140
use Minishlink\WebPush\WebPush;
121
141
122
-
$webPush = new WebPush(); // default TTL is 4 weeks
@@ -72,17 +72,13 @@ public function __construct(array $apiKeys = array(), $TTL = 2419200, $timeout =
72
72
* @param string|null $userPublicKey
73
73
* @param string|null $userAuthToken
74
74
* @param bool $flush If you want to flush directly (usually when you send only one notification)
75
-
*
75
+
* @param array $options Array with several options tied to this notification. If not set, will use the default options that you can set in the WebPush object.
76
76
* @return array|bool Return an array of information if $flush is set to true and the queued requests has failed.
0 commit comments