向特定用户发送通知

向特定用户发送通知

问题描述:

我想在用户收到消息时发送通知.

I would like to send a notification when a user receives a message.

例如当用户A向用户B发送消息时,我希望该用户B收到通知,例如在Facebook Messenger中.

For example When user A send a message to user B, I would like that B receives a notification, like in Facebook Messenger.

为此,我在数据库中注册了FCM TOKEN,但我不知道如何使用我的代码向特定用户发送通知.

To do that, I register the FCM TOKEN in my database but I do not know how to send a notification to a specific user with my code.

我在firebase的文档中看到他们提出了 FCM服务器但我不知道如何在iO上使用它.

I saw in the documentation of firebase that they proposes a FCM SERVER but I do not know how to use it on iOs.

谢谢您的帮助!

有很多关于此的在线教程.找到了一个可能解决您的问题的方法: https://www.raywenderlich.com/140836/firebase-实时聊天教程2

There are many tutorials about that online. Found one that might solve your problem: https://www.raywenderlich.com/140836/firebase-tutorial-real-time-chat-2

通常,您只需要为1-1消息创建频道并将其推送到该频道即可.

In general, all you need is to create channels for your 1-1 messages and push to that channel.

希望有帮助.