我不太了解如何向收到操作的用户发送通知。例如,当User A
向User B
添加评论等时,我希望User B
收到通知。
如果User A
添加评论等,我可以向此模式中User A
主题中订阅的每位关注者发送通知。关注者主题订阅:
FCMPlugin.subscribeToTopic('topicExample');
我通过User A
发送REST API通知:
{
"notification":{
"title":"Notification title", //Any value
"body":"Notification body", //Any value
"sound":"default", //If you want notification sound
"click_action":"FCM_PLUGIN_ACTIVITY", //Must be present for Android
"icon":"fcm_push_icon" //White icon Android resource
},
"data":{
"param1":"value1", //Any data to be retrieved in the notification callback
"param2":"value2"
},
"to":"/topics/topicExample", //Topic or single device
"priority":"high", //If not set, notification won't be delivered on completely closed iOS app
"restricted_package_name":"" //Optional. Set for application filtering
}
但我不明白如何向User B
发送通知,因为他未订阅至User A
,是否可以仅发送通知订阅某个主题的用户?