Push notification to all the users subscribed to t

2019-01-09 13:54发布

问题:

Now i have a group which have more than ten thousand members and for a group i have created a topic(Notification topic) where all the users in the group subscribed to that topic. Now inside the group any user can add post like image or file or video. When user add the post i need to send notification to all the users subscribed to that topic but except one, that is person who add the post. How can i achieve this??

Now notification is going to all the users including the person who add the post.

回答1:

There is currently no parameter of any sort to exclude a specific user from receiving a message from a topic they are subscribed to. However, as a workaround, you could simply have a custom implementation on building the payload and handling the message to receive it.

Depending on how you build your payload, you could just add a custom key-value pair that includes the user id of the one who posted the data (something like posterId or simply userId).

Then on your client side, when handling the push notification, just check if the id is the user's or not. If it is the same user, don't show the notification, else show it. e.g.:

if (userId == currentUserId) {
    // if user is the one that sent the message, don't show the notification
    return;
}