Kreait/Firebase 提供了通过 Firebase 云消息传递向订阅设备发送消息的绝佳途径。总的来说,documentation 非常出色。但是,该文档没有解释调用 send
等方法返回的信息(如果有)。以下面的例子
$factory = (new Factory)->withServiceAccount('/path/to/firebase_config.json');
$messaging = $factory->createMessaging();
$condition = ...;//define a few conditions
$notif = ...;//define the notification
$data = ...;//define some data to send
$message = CloudMessage::withTarget('condition',$condition)->withNotification($notif)-
>withData($data);
$rslt = $messaging->send($message);
我发现在大多数情况下,此代码返回 {"codd":1}
。然而,有时我有
"{"name":"projects/`project_id/messages/long_number"}{"code":1}"
我该如何解释和/或知道这是一个错误。我一直无法找到解释此问题的 Firebase 文档。