[英]Push notification with pusher beam, unable to send data/payload
我正在使用以下 php sdk 來生成推送梁推送通知。 但是 sdk 文檔中沒有提供有關如何發送數據/有效負載的信息。 通知是正確發送的 bean,但我無法發送數據:請指導我如何發送數據:它在光束控制台中顯示 hasData 為 false,請檢查:
php sdk 我正在使用: https://github.com/pusher/push-notifications-php
我的代碼如下所示:
$pushNotification = new PushNotifications([
'instanceId' => env('BEAM_INSTANCE_ID'),
'secretKey' => env('BEAM_PRIMARY_KEY')
]);
$pushNotification->publishToInterests(
['message-notification'],
[
"apns" => [
"aps" => [
"alert" => "Message Received",
],
],
"fcm" => [
"notification" => [
'title' => 'some title',
'body' => 'some body',
'data' => 'some data', //passing data here but not working
],
],
]
);
我搞定了,我們可以通過以下方式傳遞數據:
$publishResponse = $pushNotifications->publishToInterests(
["donuts"],
[
"apns" => [
"aps" => [
"alert" => "Hello!",
],
],
"fcm" => [
"notification" => [
"title" => "Hello!",
"body" => "Hello, world!",
],
"data" => [ // <==== pass data here
"name" => "adam",
"type" => "user",
],
],
]
);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.