pushok
pushok copied to clipboard
Laravel Vapor - HTTP/2 stream 15 was not closed cleanly before end of the underlying stream
Hey all,
I'm getting an issue in Laravel Vapor that I can't recreate locally. Stack trace attached:
Exception: HTTP/2 stream 15 was not closed cleanly before end of the underlying stream in /var/task/vendor/edamov/pushok/src/Client.php:161
Stack trace:
#0 /var/task/vendor/laravel-notification-channels/apn/src/ApnChannel.php(79): Pushok\Client->push()
#1 /var/task/vendor/laravel-notification-channels/apn/src/ApnChannel.php(58): NotificationChannels\Apn\ApnChannel->sendNotifications(Object(Pushok\Client), Object(NotificationChannels\Apn\ApnMessage), Array)
#2 /var/task/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php(148): NotificationChannels\Apn\ApnChannel->send(Object(App\Models\User), Object(App\Notifications\NewEpisode))
Thank you!
Sounds similar to my recent issue. Hmm. Perhaps Apple changed something on their end?
Hey there, did either of you happen to find a solution?
Only thing I did (that worked for me) is break the push messages up into chunks of 10000 tokens per client object
So for each group of 10000 tokens, here's my pseudo-code:
$client = new Client($authProvider, $production = $pushenv);
$client->setAutoCloseConnections ( true );
$client->setNbConcurrentRequests( 40 );
$client->setMaxConcurrentConnections( 15 );
$client->addNotifications($notifications); //have previously built the $notifications array
$responses = $client->push();
$client->close();
unset($client);
unset($notifications);
I loop through that however many times it takes to get through all the tokens and it seems to be working.