web-push-libs / web-push-php

Web Push library for PHP
MIT License
1.72k stars 301 forks source link

size of payload must not be greater than 4078 octets #369

Closed hudakhshfeh closed 8 months ago

hudakhshfeh commented 1 year ago

Sometimes this error appears on some transmissions, although it successfully sends the same message to other people What is the cause of this error and how do I correct it Help please

DorianThDev commented 1 year ago

Hello, There are not real standards for push notification services, and some does not support this playload lenght. If affects the push behavior on some browsers as Firefox for Android. Reducing the playload lenght and automatic padding can be a solution :

$webPush = new WebPush();
$webPush->setAutomaticPadding(2048);
Minishlink commented 8 months ago

Yes, see #108