kreait / firebase-php

Unofficial Firebase Admin SDK for PHP
https://firebase-php.readthedocs.io/
MIT License
2.21k stars 423 forks source link

Unknown limit of devices to send to via multicast #873

Closed Nicasso closed 4 months ago

Nicasso commented 5 months ago

Describe the bug

Since Google is deprecating the Batch Send API starting 6/21/2024, you've rewritten the sendMulticast logic to use their recommended standard HTTP v1 API send method (https://firebase.google.com/support/faq#fcm-23-deprecation). So far so good. However, since upgrading this package and thus starting to use this logic I experience issues when passing large batches of 500 device tokens to the sendMulticast function. The outcome is that from the 500 sends less than 10 will actually succeed. Most will return the following error:

Unable to connect to the API: cURL error 35: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to fcm.googleapis.com:443 (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://fcm.googleapis.com/v1/projects/xxxxx/messages:send

Lowering the amount of device tokens that I pass to the sendMulticast function to 50 seems to have resolved the issue. However, spreading the device tokens into smaller batches does increase the execution time quite a bit. So I'm curious, does this situation sound familiair? Is there some kind of limit I am unaware of regarding the amount of device tokens I can pass each time I call the sendMulticast function?

Installed packages

beste/clock                                3.0.0     A collection of Clock implementations
beste/json                                 1.4.0     A simple JSON helper to decode and encode JSON
brianium/paratest                          v6.11.0   Parallel testing for PHP
brick/math                                 0.11.0    Arbitrary-precision arithmetic library
carbonphp/carbon-doctrine-types            1.0.0     Types to use Carbon in Doctrine
clue/stdio-react                           v2.6.0    Async, event-driven console input & output (STDIN, STDOUT) for truly interactive CLI applications, built on top of ReactPHP
clue/stream-filter                         v1.7.0    A simple and modern approach to stream filtering in PHP
clue/term-react                            v1.4.0    Streaming terminal emulator, built on top of ReactPHP.
clue/utf8-react                            v1.3.0    Streaming UTF-8 parser, built on top of ReactPHP.
cweagans/composer-patches                  1.7.3     Provides a way to patch Composer packages.
defuse/php-encryption                      v2.4.0    Secure PHP Encryption Library
dflydev/dot-access-data                    v3.0.2    Given a deep data structure, access data by dot notation.
doctrine/cache                             2.2.0     PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.
doctrine/dbal                              2.13.9    Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/deprecations                      1.1.3     A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.
doctrine/event-manager                     1.2.0     The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                         2.0.10    PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.
doctrine/instantiator                      2.0.0     A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                             3.0.1     PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
dragonmantank/cron-expression              v3.3.3    CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
egulias/email-validator                    4.0.2     A library for validating emails against several RFCs
evenement/evenement                        v3.0.2    Événement is a very simple event dispatching library for PHP
exolnet/laravel-sqlite-fluent-drop-foreign v1.7.0    Add a fluent dropForeign when using sqlite database
fakerphp/faker                             v1.23.1   Faker is a PHP library that generates fake data for you.
fideloper/proxy                            4.4.2     Set trusted proxies for Laravel
fidry/cpu-core-counter                     1.1.0     Tiny utility to get the number of CPU cores.
fig/http-message-util                      1.1.5     Utility classes and constants for use with PSR-7 (psr/http-message)
filp/whoops                                2.15.4    php error handling for cool kids
firebase/php-jwt                           v6.10.0   A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.
fruitcake/php-cors                         v1.3.0    Cross-origin resource sharing library for the Symfony HttpFoundation
google/auth                                v1.37.0   Google Auth Library for PHP
google/cloud-core                          v1.56.1   Google Cloud PHP shared dependency, providing functionality useful to all components.
google/cloud-storage                       v1.39.1   Cloud Storage Client for PHP
google/common-protos                       v4.5.0    Google API Common Protos for PHP
google/gax                                 v1.30.0   Google API Core for PHP
google/grpc-gcp                            v0.3.0    gRPC GCP library for channel management
google/longrunning                         0.3.1     Google LongRunning Client for PHP
google/protobuf                            v3.25.3   proto library for PHP
graham-campbell/result-type                v1.1.2    An Implementation Of The Result Type
grpc/grpc                                  1.57.0    gRPC library for PHP
guzzlehttp/guzzle                          7.8.1     Guzzle is a PHP HTTP client library
guzzlehttp/promises                        2.0.2     Guzzle promises library
guzzlehttp/psr7                            2.6.2     PSR-7 message implementation that also provides common utility methods
guzzlehttp/uri-template                    v1.0.3    A polyfill class for uri_template of PHP
halaxa/json-machine                        0.7.1     Efficient, easy-to-use and fast JSON pull parser
hamcrest/hamcrest-php                      v2.0.1    This is the PHP port of Hamcrest Matchers
http-interop/http-factory-guzzle           1.2.0     An HTTP Factory using Guzzle PSR7
ifsnop/mysqldump-php                       v2.12     PHP version of mysqldump cli that comes with MySQL
jean85/pretty-package-versions             2.0.5     A library to get pretty versions strings of installed dependencies
jolicode/jolinotif                         v2.6.0    Send desktop notifications on Windows, Linux, MacOS.
jolicode/php-os-helper                     v0.1.0    Helpers to detect the OS of the machine where PHP is running.
kreait/clock                               1.2       A PHP 7.0 compatible clock abstraction
kreait/firebase-php                        7.9.1     Firebase Admin SDK
kreait/firebase-tokens                     4.3.0     A library to work with Firebase tokens
kreait/laravel-firebase                    5.7.0     A Laravel package for the Firebase PHP Admin SDK
laravel-notification-channels/fcm          3.2.1     FCM (Firebase Cloud Messaging) Notifications Driver for Laravel
laravel/framework                          v9.52.16  The Laravel Framework.
laravel/passport                           v10.4.2   Laravel Passport provides OAuth2 server support to Laravel.
laravel/serializable-closure               v1.3.3    Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.
laravel/tinker                             v2.9.0    Powerful REPL for the Laravel framework.
lcobucci/clock                             3.0.0     Yet another clock abstraction
lcobucci/jwt                               4.3.0     A simple library to work with JSON Web Token and JSON Web Signature
league/commonmark                          2.4.2     Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)
league/config                              v1.2.0    Define configuration arrays with strict schemas and access values with dot notation
league/event                               2.2.0     Event package
league/flysystem                           3.24.0    File storage abstraction for PHP
league/flysystem-local                     3.23.1    Local filesystem adapter for Flysystem.
league/flysystem-sftp-v3                   3.23.1    SFTP filesystem adapter for Flysystem.
league/mime-type-detection                 1.15.0    Mime-type detection for Flysystem
league/oauth2-server                       8.5.4     A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
league/uri                                 7.4.0     URI manipulation library
league/uri-interfaces                      7.4.0     Common interfaces and classes for URI representation and interaction
melihovv/laravel-env-validator             7.0.3
mockery/mockery                            1.6.7     Mockery is a simple yet flexible PHP mock object framework
monolog/monolog                            2.9.2     Sends your logs to files, sockets, inboxes, databases and various web services
mtdowling/jmespath.php                     2.7.0     Declaratively specify how to extract elements from a JSON document
mtownsend/request-xml                      2.4.0     The missing XML support for Laravel's Request class.
mtownsend/xml-to-array                     2.0.0     Easily convert valid xml to a php array.
mtrajano/laravel-swagger                   v0.6.4    Auto generates the swagger documentation for a laravel project
myclabs/deep-copy                          1.11.1    Create deep copies (clones) of your objects
nesbot/carbon                              2.72.3    An API extension for DateTime that supports 281 different languages.
nette/schema                               v1.3.0    📐 Nette Schema: validating data structures against a given Schema.
nette/utils                                v4.0.4    🛠  Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.
nikic/php-parser                           v5.0.2    A PHP parser written in PHP
nunomaduro/collision                       v6.4.0    Cli error handling for console/command-line PHP applications.
nunomaduro/larastan                        v2.9.2    Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel
nunomaduro/termwind                        v1.15.1   Its like Tailwind CSS, but for the console.
nyholm/psr7                                1.8.1     A fast PHP7 implementation of PSR-7
paragonie/constant_time_encoding           v2.6.3    Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)
paragonie/random_compat                    v9.99.100 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
pear/http_request2                         v2.6.0    Provides an easy way to perform HTTP requests.
pear/net_url2                              v2.2.2    Class for parsing and handling URL. Provides parsing of URLs into their constituent parts (scheme, host, path etc.), URL generation, and resolving of relative URLs.
pear/pear_exception                        v1.0.2    The PEAR Exception base class.
phar-io/manifest                           2.0.4     Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                            3.2.1     Library for handling version information and constraints
php-http/client-common                     2.7.1     Common HTTP Client implementations and tools for HTTPlug
php-http/discovery                         1.19.2    Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations
php-http/httplug                           2.4.0     HTTPlug, the HTTP client abstraction for PHP
php-http/message                           1.16.0    HTTP Message related tools
php-http/message-factory                   1.1.0     Factory interfaces for PSR-7 HTTP Message
php-http/promise                           1.3.0     Promise used for asynchronous HTTP requests
php-mock/php-mock                          2.5.0     PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.
php-mock/php-mock-integration              2.3.0     Integration package for PHP-Mock
php-mock/php-mock-mockery                  1.4.1     Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.
phpcompatibility/php-compatibility         9.3.5     A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.
phpdocumentor/reflection-common            2.2.0     Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock          5.3.0     With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
phpdocumentor/type-resolver                1.8.2     A PSR-5 based resolver of Class names, Types and Structural Element Names
phplang/scope-exit                         1.0.0     Emulation of SCOPE_EXIT construct from C++
phpmyadmin/sql-parser                      5.9.0     A validating SQL lexer and parser with a focus on MySQL dialect.
phpoption/phpoption                        1.9.2     Option Type for PHP
phpseclib/phpseclib                        3.0.37    PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.
phpspec/prophecy                           v1.19.0   Highly opinionated mocking framework for PHP 5.3+
phpstan/phpdoc-parser                      1.26.0    PHPDoc parser with support for nullable, intersection and generic types
phpstan/phpstan                            1.10.63   PHPStan - PHP Static Analysis Tool
phpunit/php-code-coverage                  9.2.31    Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator                  3.0.6     FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                        3.1.1     Invoke callables with a timeout
phpunit/php-text-template                  2.0.4     Simple template engine.
phpunit/php-timer                          5.0.3     Utility class for timing
phpunit/phpunit                            9.6.17    The PHP Unit Testing framework.
predis/predis                              v1.1.10   Flexible and feature-complete Redis client for PHP and HHVM
psr/cache                                  3.0.0     Common interface for caching libraries
psr/clock                                  1.0.0     Common interface for reading the clock.
psr/container                              2.0.2     Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                       1.0.0     Standard interfaces for event handling.
psr/http-client                            1.0.3     Common interface for HTTP clients
psr/http-factory                           1.0.2     Common interfaces for PSR-7 HTTP message factories
psr/http-message                           2.0       Common interface for HTTP messages
psr/log                                    3.0.0     Common interface for logging libraries
psr/simple-cache                           3.0.0     Common interfaces for simple caching
psy/psysh                                  v0.12.0   An interactive shell for modern PHP.
ralouphie/getallheaders                    3.0.3     A polyfill for getallheaders.
ramsey/collection                          2.0.0     A PHP library for representing and manipulating collections.
ramsey/uuid                                4.7.5     A PHP library for generating and working with universally unique identifiers (UUIDs).
react/event-loop                           v1.5.0    ReactPHP's core reactor event loop that libraries can use for evented I/O.
react/stream                               v1.3.0    Event-driven readable and writable streams for non-blocking I/O in ReactPHP
rize/uri-template                          0.3.5     PHP URI Template (RFC 6570) supports both expansion & extraction
robrichards/xmlseclibs                     3.1.1     A PHP library for XML Security
sebastian/cli-parser                       1.0.2     Library for parsing CLI options
sebastian/code-unit                        1.0.8     Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup         2.0.3     Looks up which function or method a line of code belongs to
sebastian/comparator                       4.0.8     Provides the functionality to compare PHP values for equality
sebastian/complexity                       2.0.3     Library for calculating the complexity of PHP code units
sebastian/diff                             4.0.6     Diff implementation
sebastian/environment                      5.1.5     Provides functionality to handle HHVM/PHP environments
sebastian/exporter                         4.0.6     Provides the functionality to export PHP variables for visualization
sebastian/global-state                     5.0.7     Snapshotting of global state
sebastian/lines-of-code                    1.0.4     Library for counting the lines of code in PHP source code
sebastian/object-enumerator                4.0.4     Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector                 2.0.4     Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context                4.0.5     Provides functionality to recursively process PHP variables
sebastian/resource-operations              3.0.3     Provides a list of PHP built-in functions that operate on resources
sebastian/type                             3.2.1     Collection of value objects that represent the types of the PHP type system
sebastian/version                          3.0.2     Library that helps with managing the version number of Git-hosted PHP projects
selective/xmldsig                          2.4.0     Sign XML Documents with Digital Signatures
sentry/sdk                                 3.6.0     This is a metapackage shipping sentry/sentry with a recommended HTTP client.
sentry/sentry                              3.22.1    A PHP SDK for Sentry (http://sentry.io)
sentry/sentry-laravel                      3.8.2     Laravel SDK for Sentry (https://sentry.io)
spatie/backtrace                           1.5.3     A better backtrace
spatie/flare-client-php                    1.4.4     Send PHP errors to Flare
spatie/ignition                            1.12.0    A beautiful error page for PHP applications.
spatie/laravel-ignition                    1.6.4     A beautiful error page for Laravel applications.
spatie/phpunit-watcher                     1.23.6    Automatically rerun PHPUnit tests when source code changes
squizlabs/php_codesniffer                  3.9.0     PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
stella-maris/clock                         0.1.7     A pre-release of the proposed PSR-20 Clock-Interface
swaggest/json-diff                         v3.10.5   JSON diff/rearrange/patch/pointer library for PHP
swaggest/json-schema                       v0.12.42  High definition PHP structures with JSON-schema based validation
symfony/cache                              v6.4.4    Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts                    v3.4.0    Generic abstractions related to caching
symfony/console                            v6.4.4    Eases the creation of beautiful and testable command line interfaces
symfony/css-selector                       v6.4.3    Converts CSS selectors to XPath expressions
symfony/deprecation-contracts              v3.4.0    A generic function and convention to trigger deprecation notices
symfony/error-handler                      v6.4.4    Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher                   v6.4.3    Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts         v3.4.0    Generic abstractions related to dispatching event
symfony/finder                             v6.4.0    Finds files and directories via an intuitive fluent interface
symfony/http-client                        v6.4.5    Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/http-client-contracts              v3.4.0    Generic abstractions related to HTTP clients
symfony/http-foundation                    v6.4.4    Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                        v6.4.5    Provides a structured process for converting a Request into a Response
symfony/mailer                             v6.4.4    Helps sending emails
symfony/mime                               v6.4.3    Allows manipulating MIME messages
symfony/options-resolver                   v6.4.0    Provides an improved replacement for the array_replace PHP function
symfony/polyfill-ctype                     v1.29.0   Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme             v1.29.0   Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-idn                  v1.29.0   Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer           v1.29.0   Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring                  v1.29.0   Symfony polyfill for the Mbstring extension
symfony/polyfill-php72                     v1.29.0   Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php80                     v1.29.0   Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php83                     v1.29.0   Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions
symfony/polyfill-uuid                      v1.29.0   Symfony polyfill for uuid functions
symfony/process                            v6.4.4    Executes commands in sub-processes
symfony/psr-http-message-bridge            v2.3.1    PSR HTTP message bridge
symfony/routing                            v6.4.5    Maps an HTTP request to a set of configuration variables
symfony/service-contracts                  v3.4.1    Generic abstractions related to writing services
symfony/string                             v6.4.4    Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation                        v6.4.4    Provides tools to internationalize your application
symfony/translation-contracts              v3.4.1    Generic abstractions related to translation
symfony/uid                                v6.4.3    Provides an object-oriented API to generate and represent UIDs
symfony/var-dumper                         v6.4.4    Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter                       v6.4.4    Allows exporting any serializable PHP data structure to plain PHP code
symfony/yaml                               v6.4.3    Loads and dumps YAML files
symplify/vendor-patches                    11.3.7    Generate vendor patches for packages with single command
theseer/tokenizer                          1.2.3     A small library for converting tokenized PHP source code into XML and potentially other formats
tijsverkoyen/css-to-inline-styles          v2.2.7    CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.
vlucas/phpdotenv                           v5.6.0    Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
voku/portable-ascii                        2.0.1     Portable ASCII library - performance optimized (ascii) string functions for php.
webmozart/assert                           1.11.0    Assertions to validate method input/output with nice error messages.
yosymfony/resource-watcher                 v3.0.1

PHP version and extensions

composer               2.5.1    Composer package
composer-plugin-api    2.3.0    The Composer Plugin API
composer-runtime-api   2.2.2    The Composer Runtime API
ext-bcmath             8.1.14   The bcmath PHP extension
ext-bz2                8.1.14   The bz2 PHP extension
ext-ctype              8.1.14   The ctype PHP extension
ext-curl               8.1.14   The curl PHP extension
ext-date               8.1.14   The date PHP extension
ext-dom                20031129 The dom PHP extension
ext-exif               8.1.14   The exif PHP extension
ext-fileinfo           8.1.14   The fileinfo PHP extension
ext-filter             8.1.14   The filter PHP extension
ext-ftp                8.1.14   The ftp PHP extension
ext-gd                 8.1.14   The gd PHP extension
ext-hash               8.1.14   The hash PHP extension
ext-iconv              8.1.14   The iconv PHP extension
ext-intl               8.1.14   The intl PHP extension
ext-json               8.1.14   The json PHP extension
ext-ldap               8.1.14   The ldap PHP extension
ext-libxml             8.1.14   The libxml PHP extension
ext-mbstring           8.1.14   The mbstring PHP extension
ext-mysqli             8.1.14   The mysqli PHP extension
ext-mysqlnd            0        The mysqlnd PHP extension (actual version: mysqlnd 8.1.14)
ext-openssl            8.1.14   The openssl PHP extension
ext-pcntl              8.1.14   The pcntl PHP extension
ext-pcre               8.1.14   The pcre PHP extension
ext-pdo                8.1.14   The PDO PHP extension
ext-pdo_mysql          8.1.14   The pdo_mysql PHP extension
ext-pdo_sqlite         8.1.14   The pdo_sqlite PHP extension
ext-phar               8.1.14   The Phar PHP extension
ext-posix              8.1.14   The posix PHP extension
ext-readline           8.1.14   The readline PHP extension
ext-reflection         8.1.14   The Reflection PHP extension
ext-session            8.1.14   The session PHP extension
ext-simplexml          8.1.14   The SimpleXML PHP extension
ext-soap               8.1.14   The soap PHP extension
ext-sodium             8.1.14   The sodium PHP extension
ext-spl                8.1.14   The SPL PHP extension
ext-sqlite3            8.1.14   The sqlite3 PHP extension
ext-tokenizer          8.1.14   The tokenizer PHP extension
ext-xml                8.1.14   The xml PHP extension
ext-xmlreader          8.1.14   The xmlreader PHP extension
ext-xmlwriter          8.1.14   The xmlwriter PHP extension
ext-xsl                8.1.14   The xsl PHP extension
ext-zend-opcache       8.1.14   The Zend OPcache PHP extension
ext-zip                1.19.5   The zip PHP extension
ext-zlib               8.1.14   The zlib PHP extension
lib-bz2                1.0.8    The bz2 library
lib-curl               7.74.0   The curl library
lib-curl-libssh2       1.9.0    curl libssh2 version
lib-curl-openssl       1.1.1.14 curl OpenSSL version (1.1.1.14)
lib-curl-zlib          1.2.11   curl zlib version
lib-date-timelib       2021.18  date timelib version
lib-date-zoneinfo      2022.7   zoneinfo ("Olson") database for date
lib-fileinfo-libmagic  540      fileinfo libmagic version
lib-gd                 2.0.35   The gd library
lib-gd-libpng          1.6.37   libpng version for gd
lib-iconv              2.31     The iconv library
lib-icu                67.1     The ICU unicode and globalization support library
lib-icu-cldr           37       ICU CLDR project version
lib-icu-unicode        13.0.0   ICU unicode version
lib-ldap-openldap      2.4.57   OpenLDAP version of ldap
lib-libsodium          1.0.18   The libsodium library
lib-libxml             2.9.10   libxml library version
lib-libxslt            1.1.34   The libxslt library
lib-libxslt-libxml     2.9.10   libxml version libxslt is compiled against
lib-mbstring-libmbfl   1.3.2    mbstring libmbfl version
lib-mbstring-oniguruma 6.9.6    mbstring oniguruma version
lib-openssl            1.1.1.14 OpenSSL 1.1.1n  15 Mar 2022
lib-pcre               10.39    The pcre library
lib-pcre-unicode       14.0.0   PCRE Unicode version support
lib-pdo_sqlite-sqlite  3.34.1   The pdo_sqlite-sqlite library
lib-sqlite3-sqlite     3.34.1   The sqlite3-sqlite library
lib-zip-libzip         1.7.3    The zip-libzip library
lib-zlib               1.2.11   The zlib library
php                    8.1.14   The PHP interpreter
php-64bit              8.1.14   The PHP interpreter, 64bit
php-ipv6               8.1.14   The PHP interpreter, with IPv6 support

Steps to reproduce the issue.

Just run the sendMulticast with and pass it an array of 500 device tokens. Something in the lines of:


use Kreait\Firebase\Exception\FirebaseException;
use Kreait\Firebase\Exception\MessagingException;
use Kreait\Firebase\Messaging\CloudMessage;
use Kreait\Firebase\Messaging\Notification;

$notification = Notification::create("title", "body");
$messaging = app("firebase.messaging");
$message = CloudMessage::new()->withNotification($notification);
$device_tokens = ['token-1', 'token-2', 'token-...', 'token-500'];

try {
  $report = $messaging->sendMulticast($message, $device_tokens);
} catch (MessagingException $e) {
  $this->error("MessagingException: {$e->getMessage()}");
} catch (FirebaseException $e) {
  $this->error("FirebaseException: {$e->getMessage()}");
}

if ($report->hasFailures()) {
  foreach ($report->failures()->getItems() as $failure) {
    $this->error(
      $failure->error()->getMessage(),
      [
        $failure->error()->getCode(),
        $failure->target()->type(),
        $failure->target()->value()
      ]
    );
  }
}

$this->info("Successful sends: {$report->successes()->count()}");
$this->warn("Failed sends: {$report->failures()->count()}");

Error message/Stack trace

Unable to connect to the API: cURL error 35: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to fcm.googleapis.com:443 (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://fcm.googleapis.com/v1/projects/xxxxx/messages:send

Additional information

No response

jeromegamez commented 4 months ago

Thank you for bringing this up! Unfortunately, this doesn't sound familiar, at least to me, and everything I can find related to a cURL Error 35 and SSL_ERROR_SYSCALL is related to outdated versions of cURL, problems with proxies or the server receiving the requests.

But I assume you came to the same conclusion and have checked https://firebase-php.readthedocs.io/en/latest/troubleshooting.html#curl-error-xx as well.

Since the deprecated endpoint was able to receive 500 messages with one request, and the new method requires 500 requests, it sounds reasonable that messages take longer and are more prone to errors, but I, of course understand that this answer is not satisfactory 😅.

I remember having seen someone talk about HTTP/2 in the context of the SDK in the past, but I can't seem to find it. I'm not too familiar with it, and I don't know if Guzzle actually supports HTTP/2, but let me know if #874 improves the situation.

bi122 commented 4 months ago

Try to update curl. I have same problem and update from 7.81 to 7.88.1 (build from source on ubuntu 22.04) and this fix problem

tonysilva16 commented 4 months ago

Try to update curl. I have same problem and update from 7.81 to 7.88.1 (build from source on ubuntu 22.04) and this fix problem

Are you using the branch with http2 enable? We were having issues with "Unable to connect to the API: cURL error 52: Empty reply from server" and using #874 branch seems to have fixed the issue. Still using curl (7.74.0-1.3)

jeromegamez commented 4 months ago

Ah, after three weeks, some feedback on that PR 🥳. I'll merge and release it, then.

jeromegamez commented 4 months ago

It took a little more time than expected, but in return, sending many messages will take considerably less time going forward. I'll release #874 in the next days.

jeromegamez commented 4 months ago

Released with https://github.com/kreait/firebase-php/releases/tag/7.10.0 🚀