The Extension Manager
The Web Push service requires an Extension Manager. This object manages extensions that will manipulate the request before sending it to the Push Service.
In the example below, we add all basic extensions.
Please note that the TTL Extension is usually required by Push Services. To avoid any trouble, please use all extensions.
Payload Extension
The payload extension allows Notifications to have a payload. This extension requires Content Encoding objects that will be responsible of the payload encryption.
The library provides the AESGCM
and AES128GCM
content encoding. These encodings are normally supported by all Push Services. The library is able to support any future encoding is deemed necessary.
VAPID Extension
The VAPID header authenticates your server and prevent malicious application to send notifications to your users. The header contains a signed JSON Web Token (JWS).
The library provides bridges for the following libraries web-token
and lcobucci/jwt
.
Please install web-token/jwt-signature-algorithm-ecdsa
or lcobucci/jwt
depending on the library you want to use.
The public key used with your server shall be the same as the one in your Javascript application.
If this public/private key changes, subscriptions will become invalid.
Last updated