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
Each notification can have a specific Time To Live, urgency, and topic.
128
128
You can change the default options with `setDefaultOptions()` or in the constructor:
129
129
@@ -135,7 +135,8 @@ use Minishlink\WebPush\WebPush;
135
135
$defaultOptions = array(
136
136
'TTL' => 300, // defaults to 4 weeks
137
137
'urgency' => 'normal', // protocol defaults to "normal"
138
-
'topic' => 'new_event', // not defined by default
138
+
'topic' => 'new_event', // not defined by default,
139
+
'batchSize' => 200, // defaults to 1000
139
140
);
140
141
141
142
// for every notifications
@@ -159,6 +160,12 @@ Urgency can be either "very-low", "low", "normal", or "high". If the browser ven
159
160
#### topic
160
161
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](https://tools.ietf.org/html/draft-ietf-webpush-protocol-08#section-5.4)).
161
162
163
+
#### batchSize
164
+
If you send tens of thousands notifications at a time, you may get memory overflows due to how endpoints are called in Guzzle.
165
+
In order to fix this, WebPush sends notifications in batches. The default size is 1000. Depending on your server configuration (memory), you may want
166
+
to decrease this number. Do this while instanciating WebPush or calling `setDefaultOptions`. Or, if you want to customize this for a specific flush, give
167
+
it as a parameter : `$webPush->flush($batchSize)`.
168
+
162
169
### Server errors
163
170
You can see what the browser vendor's server sends back in case it encountered an error (push subscription expiration, wrong parameters...).
164
171
`sendNotification()` (with flush as true) and `flush()` returns true if there were no errors. If there are errors it returns an array like the following.
You won't be able to send any payload, so you'll be only able to use `sendNotification($endpoint)`.
289
-
Install the libray with `composer` using `--ignore-platform-reqs`.
295
+
You won't be able to send any payload, so you'll only be able to use `sendNotification($endpoint)`.
296
+
Install the library with `composer` using `--ignore-platform-reqs`.
290
297
The workaround for getting the payload is to fetch it in the service worker ([example](https://github.com/Minishlink/physbook/blob/2ed8b9a8a217446c9747e9191a50d6312651125d/web/service-worker.js#L75)).
0 commit comments